public override void VisitCompoundAssignment(ICompoundAssignmentOperation operation) { Assert.Equal(OperationKind.CompoundAssignment, operation.Kind); var operatorMethod = operation.OperatorMethod; var binaryOperationKind = operation.OperatorKind; var inConversion = operation.InConversion; var outConversion = operation.OutConversion; if (operation.Syntax.Language == LanguageNames.CSharp) { Assert.Throws <ArgumentException>("compoundAssignment", () => VisualBasic.VisualBasicExtensions.GetInConversion(operation)); Assert.Throws <ArgumentException>("compoundAssignment", () => VisualBasic.VisualBasicExtensions.GetOutConversion(operation)); var inConversionInteranl = CSharp.CSharpExtensions.GetInConversion(operation); var outConversionInteranl = CSharp.CSharpExtensions.GetOutConversion(operation); } else { Assert.Throws <ArgumentException>("compoundAssignment", () => CSharp.CSharpExtensions.GetInConversion(operation)); Assert.Throws <ArgumentException>("compoundAssignment", () => CSharp.CSharpExtensions.GetOutConversion(operation)); var inConversionInternal = VisualBasic.VisualBasicExtensions.GetInConversion(operation); var outConversionInternal = VisualBasic.VisualBasicExtensions.GetOutConversion(operation); } var isLifted = operation.IsLifted; var isChecked = operation.IsChecked; VisitAssignment(operation); }
public override void VisitCompoundAssignment(ICompoundAssignmentOperation operation) { var operatorMethod = operation.OperatorMethod; var binaryOperationKind = operation.OperatorKind; base.VisitCompoundAssignment(operation); }
public void ICompoundAssignment_NullArgumentToGetConversionThrows() { ICompoundAssignmentOperation nullAssignment = null; Assert.Throws <ArgumentNullException>("compoundAssignment", () => nullAssignment.GetInConversion()); Assert.Throws <ArgumentNullException>("compoundAssignment", () => nullAssignment.GetOutConversion()); }
public override ValueContentAbstractValue ComputeValueForCompoundAssignment( ICompoundAssignmentOperation operation, ValueContentAbstractValue targetValue, ValueContentAbstractValue assignedValue, ITypeSymbol targetType, ITypeSymbol assignedValueType) { return(targetValue.MergeBinaryOperation(assignedValue, operation.OperatorKind, targetType, assignedValueType, operation.Type)); }
public override bool VisitCompoundAssignment([NotNull] ICompoundAssignmentOperation operation1, [CanBeNull] IOperation argument) { return(argument is ICompoundAssignmentOperation operation2 && AreBaseOperationsEqual(operation1, operation2) && operation1.OperatorKind == operation2.OperatorKind && AreSymbolsEqual(operation1.OperatorMethod, operation2.OperatorMethod) && operation1.IsLifted == operation2.IsLifted && operation1.IsChecked == operation2.IsChecked && operation1.InConversion.Equals(operation2.InConversion) && operation1.OutConversion.Equals(operation2.OutConversion)); }
private static AbstractExpression ReadCompoundAssignment(ICompoundAssignmentOperation op) { if (!CompoundAssignmentByOperatorKind.TryGetValue(op.OperatorKind, out var compoundOp)) { throw new NotSupportedException( $"Compound assignment kind {op.OperatorKind} ({op.GetType().Name}) is not supported"); } var result = (AssignmentExpression)ReadAssignment(op); result.CompoundOperator = compoundOp; return(result); }
public override StringContentAbstractValue VisitCompoundAssignment(ICompoundAssignmentOperation operation, object argument) { StringContentAbstractValue value; switch (operation.OperatorKind) { case BinaryOperatorKind.Add: case BinaryOperatorKind.Concatenate: var leftValue = Visit(operation.Target, argument); var rightValue = Visit(operation.Value, argument); value = leftValue.MergeBinaryAdd(rightValue); break; default: value = base.VisitCompoundAssignment(operation, argument); break; } SetAbstractValueForAssignment(operation.Target, operation.Value, value); return(value); }
public override IOperation VisitCompoundAssignment(ICompoundAssignmentOperation operation, object argument) { var compoundAssignment = (BaseCompoundAssignmentExpression)operation; return(new CompoundAssignmentOperation(Visit(operation.Target), Visit(operation.Value), compoundAssignment.InConversionConvertible, compoundAssignment.OutConversionConvertible, operation.OperatorKind, operation.IsLifted, operation.IsChecked, operation.OperatorMethod, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit)); }
public virtual void VisitCompoundAssignment(ICompoundAssignmentOperation operation) { DefaultVisit(operation); }
public override void VisitCompoundAssignment([NotNull] ICompoundAssignmentOperation operation) { RegisterAssignment(operation.Target); base.VisitCompoundAssignment(operation); }
public override void VisitCompoundAssignment([NotNull] ICompoundAssignmentOperation operation) { base.VisitCompoundAssignment(operation); }
public override StringContentAbstractValue ComputeValueForCompoundAssignment(ICompoundAssignmentOperation operation, StringContentAbstractValue targetValue, StringContentAbstractValue assignedValue) { switch (operation.OperatorKind) { case BinaryOperatorKind.Add: case BinaryOperatorKind.Concatenate: return(targetValue.MergeBinaryAdd(assignedValue)); default: return(base.ComputeValueForCompoundAssignment(operation, targetValue, assignedValue)); } }
public override Scope VisitCompoundAssignment(ICompoundAssignmentOperation operation, Scope currentScope) { var scope = operation.Value.Accept(this, currentScope); return(operation.Target.Accept(this, scope)); }
public override Scope VisitCompoundAssignment(ICompoundAssignmentOperation operation, Scope currentScope) => currentScope;
public override void VisitCompoundAssignment(ICompoundAssignmentOperation operation) { base.VisitCompoundAssignment(operation); throw new NotImplementedException(); }
/// <summary> /// コンストラクタ /// </summary> /// <param name="operation">IOperationインスタンス</param> /// <param name="container">イベントコンテナ</param> public CompoundAssignment(ICompoundAssignmentOperation operation, EventContainer container) : base(container) { // 対象インスタンス Expressions.AddRange(OperationFactory.GetExpressionList(operation.Target, container)); var operatorName = string.Empty; switch (operation.OperatorKind) { case BinaryOperatorKind.Add: operatorName = "+"; break; case BinaryOperatorKind.Subtract: operatorName = "-"; break; case BinaryOperatorKind.Multiply: operatorName = "*"; break; case BinaryOperatorKind.Divide: operatorName = "/"; break; case BinaryOperatorKind.And: operatorName = "&&"; break; case BinaryOperatorKind.ConditionalAnd: operatorName = "&"; break; case BinaryOperatorKind.ConditionalOr: operatorName = "|"; break; case BinaryOperatorKind.Equals: operatorName = "=="; break; case BinaryOperatorKind.ExclusiveOr: operatorName = "^"; break; case BinaryOperatorKind.GreaterThan: operatorName = ">"; break; case BinaryOperatorKind.GreaterThanOrEqual: operatorName = ">="; break; case BinaryOperatorKind.LessThan: operatorName = "<"; break; case BinaryOperatorKind.LessThanOrEqual: operatorName = "<="; break; case BinaryOperatorKind.NotEquals: operatorName = "!="; break; case BinaryOperatorKind.Or: operatorName = "||"; break; } if (!string.IsNullOrEmpty(operatorName)) { Expressions.Add(new Expression($"{operatorName}=", string.Empty)); } // 値 Expressions.AddRange(OperationFactory.GetExpressionList(operation.Value, container)); }