Пример #1
0
        /// <summary>Gets an unary operation.</summary>
        /// <param name="op">The operation's operator type.</param>
        /// <returns>A TypeOperation if the operation is found. Null if it is not found.</returns>
        public virtual IUnaryTypeOperation GetOperation(UnaryTypeOperator op)
        {
            CodeType current = _type;

            while (current != null)
            {
                if (current.Operations != null)
                {
                    foreach (IUnaryTypeOperation operation in current.Operations._unaryTypeOperations)
                    {
                        if (operation.Operator == op)
                        {
                            return(operation);
                        }
                    }
                }

                current = current.Extends;
            }
            return(null);
        }
 public override IUnaryTypeOperation GetOperation(UnaryTypeOperator op) => GetOperation(() => base.GetOperation(op), toi => toi.GetOperation(op));
Пример #3
0
 public bool IsUnaryOperator(UnaryTypeOperator op) => _unaryTypeOperations.Any(unaryOp => op == unaryOp.Operator);
Пример #4
0
 public UnaryTypeOperation(UnaryTypeOperator op, CodeType returnType, Func <IWorkshopTree, IWorkshopTree> resolver)
 {
     Operator   = op;
     ReturnType = returnType;
     _resolver  = resolver;
 }