public override bool VisitUnaryOperator([NotNull] IUnaryOperation operation1, [CanBeNull] IOperation argument) { return(argument is IUnaryOperation operation2 && AreBaseOperationsEqual(operation1, operation2) && operation1.OperatorKind == operation2.OperatorKind && AreSymbolsEqual(operation1.OperatorMethod, operation2.OperatorMethod) && operation1.IsLifted == operation2.IsLifted && operation1.IsChecked == operation2.IsChecked); }
public string Subtraction_entered() { is_num_entered = false; unary_pending_operation = null; binary_pending_operation = new Subtraction(); return(result); }
public override void VisitUnaryOperator(IUnaryOperation operation) { if (operation.OperatorKind == UnaryOperatorKind.Not) { Visit(operation.Operand); } }
public void AddUnaryOperation(IUnaryOperation operation) { if (!UnaryOperations.Contains(operation)) { UnaryOperations.Add(operation); } }
private void OnCompilationStart(CompilationStartAnalysisContext compilationContext) { var restrictedInternalsVisibleToMap = GetRestrictedInternalsVisibleToMap(compilationContext.Compilation); if (restrictedInternalsVisibleToMap.IsEmpty) { return; } var namespaceToIsBannedMap = new ConcurrentDictionary<INamespaceSymbol, /*isBanned*/bool>(); // Verify all explicit type name specifications in declarations and executable code. compilationContext.RegisterSyntaxNodeAction( context => { var name = (TNameSyntax)context.Node; if (!IsInTypeOnlyContext(name) || name.Parent is TNameSyntax) { // Bail out if we are not in type only context or the parent is also a name // which will be analyzed separately. return; } var typeInfo = context.SemanticModel.GetTypeInfo(name, context.CancellationToken); VerifySymbol(typeInfo.Type as INamedTypeSymbol, name, context.ReportDiagnostic, restrictedInternalsVisibleToMap, namespaceToIsBannedMap); }, NameSyntaxKinds); // Verify all member usages in executable code. compilationContext.RegisterOperationAction( context => { var symbol = context.Operation switch { IObjectCreationOperation objectCreation => objectCreation.Constructor, IInvocationOperation invocation => invocation.TargetMethod, IMemberReferenceOperation memberReference => memberReference.Member, IConversionOperation conversion => conversion.OperatorMethod, IUnaryOperation unary => unary.OperatorMethod, IBinaryOperation binary => binary.OperatorMethod, IIncrementOrDecrementOperation incrementOrDecrement => incrementOrDecrement.OperatorMethod, _ => throw new NotImplementedException($"Unhandled OperationKind: {context.Operation.Kind}"), }; VerifySymbol(symbol, context.Operation.Syntax, context.ReportDiagnostic, restrictedInternalsVisibleToMap, namespaceToIsBannedMap); }, OperationKind.ObjectCreation, OperationKind.Invocation, OperationKind.EventReference, OperationKind.FieldReference, OperationKind.MethodReference, OperationKind.PropertyReference, OperationKind.Conversion, OperationKind.UnaryOperator, OperationKind.BinaryOperator, OperationKind.Increment, OperationKind.Decrement); }
public string Reciprocal_entered() { unary_operation = new Reciprocal(); string firstEnteredValue = UnaryEquals(); return(firstEnteredValue); }
public string RunUnaryOperation(string operation) { Unary_operation_factory factory = new Unary_operation_factory(); unary_operation = factory.GetOperation(operation); if (equals_flag) { ClearAllButLhs(); } if (Lhs.IsNotSet()) { Lhs.Value = 0; Lhs.Value = unary_operation.PerformUnaryCalculation(Lhs.Value); return(Lhs.Value.ToString()); } else if (pending_operation == null) { Lhs.Value = unary_operation.PerformUnaryCalculation(Lhs.Value); return(Lhs.Value.ToString()); } else if (Rhs.IsNotSet()) { Rhs.Value = unary_operation.PerformUnaryCalculation(Lhs.Value); return(Rhs.Value.ToString()); } else // if (Rhs.IsSet()) { Rhs.Value = unary_operation.PerformUnaryCalculation(Rhs.Value); return(Rhs.Value.ToString()); } }
public string Clear_entered() { pending_operation = null; unary_operation = null; firstEnteredValue = 0.0; lastEnteredValue = 0.0; return("0"); }
public override void Visit(IUnaryOperation unaryOperation) { if (Process(unaryOperation)) { visitor.Visit(unaryOperation); } base.Visit(unaryOperation); }
public override void VisitUnaryOperator(IUnaryOperation operation) { var operatorMethod = operation.OperatorMethod; var unaryOperationKind = operation.OperatorKind; var isLifted = operation.IsLifted; var isChecked = operation.IsChecked; base.VisitUnaryOperator(operation); }
public override void VisitUnaryOperator(IUnaryOperation operation) { Assert.Equal(OperationKind.UnaryOperator, operation.Kind); var operatorMethod = operation.OperatorMethod; var unaryOperationKind = operation.OperatorKind; var isLifted = operation.IsLifted; var isChecked = operation.IsChecked; Assert.Same(operation.Operand, operation.Children.Single()); }
public string Clear_entered() { lhs = 0; rhs = 0; result = "0"; is_num_entered = false; is_decimal_entered = false; binary_pending_operation = null; unary_pending_operation = null; return(result); }
public override FlightEnabledAbstractValue VisitUnaryOperatorCore(IUnaryOperation operation, object?argument) { var value = base.VisitUnaryOperatorCore(operation, argument); if (operation.OperatorKind == UnaryOperatorKind.Not && value.Kind == FlightEnabledAbstractValueKind.Known) { return(value.GetNegatedValue()); } return(value); }
public string Reciprocal_entered() { is_num_entered = false; binary_pending_operation = null; unary_pending_operation = new Reciprocal(); if (Convert.ToDouble(result) == 0.0) { Clear_entered(); return("Divide by Zero Error"); } lhs = unary_pending_operation.Perform_unary_calculation(Convert.ToDouble(result)); result = lhs.ToString(); return(lhs.ToString()); }
public string Square_root_entered() { is_num_entered = false; binary_pending_operation = null; unary_pending_operation = new Square_root(); if (Convert.ToDouble(result) < 0.0) { Clear_entered(); return("Invalid Input"); } lhs = unary_pending_operation.Perform_unary_calculation(Convert.ToDouble(result)); result = lhs.ToString(); return(lhs.ToString()); }
private void ExecuteOperation(IUnaryOperation operation, double value) { ExecuteOperation(GetExecutableInfo, GetResult); ExecutableInfo GetExecutableInfo() { return(operation.GetExecutableInfo(value)); } double GetResult() { return(operation.Execute(value)); } }
public GeneratorUnaryOperation(IUnaryOperation operation) { Type = operation.Type; Operand = GeneratorDynamicProperty.ConvertOperation(operation.Operand); }
/// <summary> /// /// </summary> /// <param name="unaryOperation"></param> internal UnaryOperation(IUnaryOperation unaryOperation) : base(unaryOperation) { this.operand = unaryOperation.Operand; }
public override IOperation VisitUnaryOperator(IUnaryOperation operation, object argument) { return(new UnaryOperatorExpression(operation.OperatorKind, Visit(operation.Operand), operation.IsLifted, operation.IsChecked, operation.OperatorMethod, ((Operation)operation).SemanticModel, operation.Syntax, operation.Type, operation.ConstantValue, operation.IsImplicit)); }
/// <summary> /// Performs some computation with the given unary operation expression. /// </summary> /// <param name="unaryOperation"></param> public virtual void Visit(IUnaryOperation unaryOperation) { this.Visit((IExpression)unaryOperation); }
/// <summary> /// Called whenever a unary operation expression is about to be traversed by a type specific routine. /// This gives the traverser the opportunity to take some uniform action for all unary operation expressions, /// regardless of how the traversal gets to them. /// </summary> public virtual void TraverseChildren(IUnaryOperation unaryOperation) { Contract.Requires(unaryOperation != null); this.TraverseChildren((IExpression)unaryOperation); this.Traverse(unaryOperation.Operand); }
/// <summary> /// Traverses the unary operation expression. /// </summary> /// <param name="unaryOperation"></param> public void Traverse(IUnaryOperation unaryOperation) { Contract.Requires(unaryOperation != null); unaryOperation.Dispatch(this.dispatchingVisitor); }
/// <summary> /// Performs some computation with the given unary operation expression. /// </summary> /// <param name="unaryOperation"></param> public virtual void Visit(IUnaryOperation unaryOperation) { }
public string Square_root_entered() { unary_operation = new SquareRoot(); UnaryEquals(); return(firstEnteredValue.ToString()); }
public override void Visit(IUnaryOperation unaryOperation) { allElements.Add(new InvokInfo(Traverser, "IUnaryOperation", unaryOperation)); }
public override Scope VisitUnaryOperator(IUnaryOperation operation, Scope currentScope) => operation.Operand.Accept(this, currentScope);
private static bool IsOperatorNot([NotNull] IUnaryOperation unaryOperator) { return(unaryOperator.OperatorKind == UnaryOperatorKind.Not); }
public override IState Next(IUnaryOperation operation) { stateParams.LeftOperand = operation.Perform(stateParams.LeftOperand); return(this); }
public override void VisitUnaryOperator([NotNull] IUnaryOperation operation) { base.VisitUnaryOperator(operation); }
public override IState Next(IUnaryOperation operation) { PerformPendingOperation(); stateParams.LeftOperand = operation.Perform(stateParams.LeftOperand); return(stateFactory.GetShowResultState(stateParams)); }
public override void TraverseChildren(IUnaryOperation unaryOperation) { MethodEnter(unaryOperation); base.TraverseChildren(unaryOperation); MethodExit(); }
public abstract IState Next(IUnaryOperation operation);
public virtual void VisitUnaryOperator(IUnaryOperation operation) { DefaultVisit(operation); }
public double DoMathOperation(IUnaryOperation calculatorMathOp, double n1) { return(calculatorMathOp.Compute(n1)); }
static void ComplexNumberUnaryArithmetics(IUnaryOperation channel, Complex z) { try { Console.WriteLine("\n*** Complex Number Unary Arithmetics ***\n"); Console.WriteLine("Conjugate[{0}] = {1}", f(z), f(channel.Conjugate(z))); Console.WriteLine("Reciprocal[{0}] = {1}", f(z), f(channel.Reciprocal(z))); Console.WriteLine("Modulus[{0}] = {1}", f(z), channel.Modulus(z)); Console.WriteLine("Argument[{0}] = {1} Radians", f(z), channel.Argument(z)); } catch (Exception fx) { Console.WriteLine(fx.Message); } }
public override void Visit(IUnaryOperation unaryOperation) { if(Process(unaryOperation)){visitor.Visit(unaryOperation);} base.Visit(unaryOperation); }