当前位置: 首页>>代码示例>>C#>>正文


C# BinaryOperatorKind类代码示例

本文整理汇总了C#中BinaryOperatorKind的典型用法代码示例。如果您正苦于以下问题:C# BinaryOperatorKind类的具体用法?C# BinaryOperatorKind怎么用?C# BinaryOperatorKind使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BinaryOperatorKind类属于命名空间,在下文中一共展示了BinaryOperatorKind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Parse

            internal SingleValueNode Parse(Lexer lexer)
            {
                while (lexer.MoveNext())
                {
                    var token = lexer.Current;

                    switch (token.TokenType)
                    {
                        case TokenType.And:
                            this.nextBinaryOperatorKind = BinaryOperatorKind.And;
                            this.UpdateExpressionTree();
                            break;

                        case TokenType.Or:
                            this.nextBinaryOperatorKind = BinaryOperatorKind.Or;
                            this.UpdateExpressionTree();
                            break;

                        default:
                            this.tokens.Enqueue(token);
                            break;
                    }
                }

                this.nextBinaryOperatorKind = BinaryOperatorKind.None;
                this.UpdateExpressionTree();

                return this.nodeStack.Pop();
            }
开发者ID:TrevorPilley,项目名称:Net.Http.WebApi.OData,代码行数:29,代码来源:FilterExpressionParser.cs

示例2: GetBinaryOperatorResultType

        /// <summary>
        /// Compute the result type of a binary operator based on the type of its operands and the operator kind.
        /// </summary>
        /// <param name="type">The type of the operators.</param>
        /// <param name="operatorKind">The kind of operator.</param>
        /// <returns>The result type of the binary operator.</returns>
        internal static ResourceType GetBinaryOperatorResultType(ResourceType type, BinaryOperatorKind operatorKind)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(type != null, "type != null");

            switch (operatorKind)
            {
                case BinaryOperatorKind.Or:                 // fall through
                case BinaryOperatorKind.And:                // fall through
                case BinaryOperatorKind.Equal:              // fall through
                case BinaryOperatorKind.NotEqual:           // fall through
                case BinaryOperatorKind.GreaterThan:        // fall through
                case BinaryOperatorKind.GreaterThanOrEqual: // fall through
                case BinaryOperatorKind.LessThan:           // fall through
                case BinaryOperatorKind.LessThanOrEqual:
                    Type resultType = Nullable.GetUnderlyingType(type.InstanceType) == null
                        ? typeof(bool)
                        : typeof(bool?);
                    return ResourceType.GetPrimitiveResourceType(resultType);

                case BinaryOperatorKind.Add:        // fall through
                case BinaryOperatorKind.Subtract:   // fall through
                case BinaryOperatorKind.Multiply:   // fall through
                case BinaryOperatorKind.Divide:     // fall through
                case BinaryOperatorKind.Modulo:
                    return type;

                default:
                    throw new ODataException(Strings.General_InternalError(InternalErrorCodes.QueryNodeUtils_BinaryOperatorResultType_UnreachableCodepath));
            }
        }
开发者ID:rambo-returns,项目名称:MonoRail,代码行数:37,代码来源:QueryNodeUtils.cs

示例3: GetBinaryOperatorResultType

        /// <summary>
        /// Compute the result type of a binary operator based on the type of its operands and the operator kind.
        /// </summary>
        /// <param name="typeReference">The type reference of the operators.</param>
        /// <param name="operatorKind">The kind of operator.</param>
        /// <returns>The result type reference of the binary operator.</returns>
        internal static IEdmPrimitiveTypeReference GetBinaryOperatorResultType(IEdmPrimitiveTypeReference typeReference, BinaryOperatorKind operatorKind)
        {
            DebugUtils.CheckNoExternalCallers();
            Debug.Assert(typeReference != null, "type != null");

            switch (operatorKind)
            {
                case BinaryOperatorKind.Or:                 // fall through
                case BinaryOperatorKind.And:                // fall through
                case BinaryOperatorKind.Equal:              // fall through
                case BinaryOperatorKind.NotEqual:           // fall through
                case BinaryOperatorKind.GreaterThan:        // fall through
                case BinaryOperatorKind.GreaterThanOrEqual: // fall through
                case BinaryOperatorKind.LessThan:           // fall through
                case BinaryOperatorKind.LessThanOrEqual:
                    return EdmCoreModel.Instance.GetBoolean(typeReference.IsNullable);

                case BinaryOperatorKind.Add:        // fall through
                case BinaryOperatorKind.Subtract:   // fall through
                case BinaryOperatorKind.Multiply:   // fall through
                case BinaryOperatorKind.Divide:     // fall through
                case BinaryOperatorKind.Modulo:
                    return typeReference;

                default:
                    throw new ODataException(Strings.General_InternalError(InternalErrorCodes.QueryNodeUtils_BinaryOperatorResultType_UnreachableCodepath));
            }
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:34,代码来源:QueryNodeUtils.cs

示例4: BinaryOperatorSignature

 public BinaryOperatorSignature(BinaryOperatorKind kind, TypeSymbol returnType, TypeSymbol leftParameterType, TypeSymbol rightParameterType)
 {
     Kind = kind;
     ReturnType = returnType;
     _leftParameterType = leftParameterType;
     _rightParameterType = rightParameterType;
 }
开发者ID:Samana,项目名称:HlslTools,代码行数:7,代码来源:BinaryOperatorSignature.cs

示例5: BoundBinaryExpression

 public BoundBinaryExpression(BinaryOperatorKind operatorKind, BoundExpression left, BoundExpression right, OverloadResolutionResult<BinaryOperatorSignature> result)
     : base(BoundNodeKind.BinaryExpression)
 {
     OperatorKind = operatorKind;
     Left = left;
     Right = right;
     Result = result;
 }
开发者ID:tgjones,项目名称:HlslTools,代码行数:8,代码来源:BoundBinaryExpression.cs

示例6: BoundBinaryExpression

 public BoundBinaryExpression(BinaryExpressionSyntax syntax, BinaryOperatorKind operatorKind, BoundExpression left, BoundExpression right, TypeSymbol type)
     : base(BoundNodeKind.BinaryExpression, syntax)
 {
     OperatorKind = operatorKind;
     Left = left;
     Right = right;
     Type = type;
 }
开发者ID:pminiszewski,项目名称:HlslTools,代码行数:8,代码来源:BoundBinaryExpression.cs

示例7: BinaryOperatorSignature

 public BinaryOperatorSignature(BinaryOperatorKind kind, TypeSymbol leftType, TypeSymbol rightType, TypeSymbol returnType, MethodSymbol method = null)
 {
     this.Kind = kind;
     this.LeftType = leftType;
     this.RightType = rightType;
     this.ReturnType = returnType;
     this.Method = method;
 }
开发者ID:afrog33k,项目名称:csnative,代码行数:8,代码来源:BinaryOperatorSignature.cs

示例8: PromoteBinaryOperandTypes

 public override void PromoteBinaryOperandTypes(
     BinaryOperatorKind binaryOperatorKind,
     ref SingleValueNode leftNode,
     ref SingleValueNode rightNode,
     out IEdmTypeReference typeReference)
 {
     stringAsEnum.PromoteBinaryOperandTypes(binaryOperatorKind, ref leftNode, ref rightNode, out typeReference);
 }
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:8,代码来源:Resolvers.cs

示例9: BoundAssignmentExpression

 public BoundAssignmentExpression(BoundExpression left, BinaryOperatorKind? operatorKind, BoundExpression right)
     : base(BoundNodeKind.AssignmentExpression)
 {
     OperatorKind = operatorKind;
     Left = left;
     Right = right;
     Type = left.Type;
 }
开发者ID:Samana,项目名称:HlslTools,代码行数:8,代码来源:BoundAssignmentExpression.cs

示例10: ShouldBeBinaryOperatorQueryToken

 public static AndConstraint<BinaryOperatorToken> ShouldBeBinaryOperatorQueryToken(this QueryToken token, BinaryOperatorKind expectedOperatorKind)
 {
     token.Should().BeOfType<BinaryOperatorToken>();
     var propertyAccessQueryToken = token.As<BinaryOperatorToken>();
     propertyAccessQueryToken.Kind.Should().Be(QueryTokenKind.BinaryOperator);
     propertyAccessQueryToken.OperatorKind.Should().Be(expectedOperatorKind);
     return new AndConstraint<BinaryOperatorToken>(propertyAccessQueryToken);
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:8,代码来源:TokenAssertions.cs

示例11: PromoteBinaryOperandTypes

 /// <summary>
 /// Promote the left and right operand types
 /// </summary>
 /// <param name="binaryOperatorKind">the operator kind</param>
 /// <param name="leftNode">the left operand</param>
 /// <param name="rightNode">the right operand</param>
 /// <param name="typeReference">type reference for the result BinaryOperatorNode.</param>
 public virtual void PromoteBinaryOperandTypes(
        BinaryOperatorKind binaryOperatorKind,
        ref SingleValueNode leftNode,
        ref SingleValueNode rightNode,
        out IEdmTypeReference typeReference)
 {
     typeReference = null;
     BinaryOperatorBinder.PromoteOperandTypes(binaryOperatorKind, ref leftNode, ref rightNode);
 }
开发者ID:larsenjo,项目名称:odata.net,代码行数:16,代码来源:ODataUriResolver.cs

示例12: BinaryOperatorQueryToken

        /// <summary>
        /// Create a new BinaryOperatorQueryToken given the operator, left and right query.
        /// </summary>
        /// <param name="operatorKind">The operator represented by this node.</param>
        /// <param name="left">The left operand.</param>
        /// <param name="right">The right operand.</param>
        public BinaryOperatorQueryToken(BinaryOperatorKind operatorKind, QueryToken left, QueryToken right)
        {
            ExceptionUtils.CheckArgumentNotNull(left, "left");
            ExceptionUtils.CheckArgumentNotNull(right, "right");

            this.operatorKind = operatorKind;
            this.left = left;
            this.right = right;
        }
开发者ID:smasonuk,项目名称:odata-sparql,代码行数:15,代码来源:BinaryOperatorQueryToken.cs

示例13: ResolveOverloads

        private static OverloadResolutionResult<BinaryOperatorSignature> ResolveOverloads(BinaryOperatorKind kind, TypeSymbol leftOperandType, TypeSymbol rightOperandType)
        {
            var builtInSignatures = GetBuiltInSignatures(kind);

            if (BothTypesBuiltIn(leftOperandType, rightOperandType))
                return OverloadResolution.Perform(builtInSignatures, leftOperandType, rightOperandType);

            return OverloadResolutionResult<BinaryOperatorSignature>.None;
        }
开发者ID:tgjones,项目名称:HlslTools,代码行数:9,代码来源:BinaryOperator.cs

示例14: MakeBinaryOperator

 private BoundExpression MakeBinaryOperator(
     CSharpSyntaxNode syntax,
     BinaryOperatorKind operatorKind,
     BoundExpression loweredLeft,
     BoundExpression loweredRight,
     TypeSymbol type,
     MethodSymbol method,
     bool isPointerElementAccess = false,
     bool isCompoundAssignment = false,
     BoundUnaryOperator applyParentUnaryOperator = null)
 {
     return MakeBinaryOperator(null, syntax, operatorKind, loweredLeft, loweredRight, type, method, isPointerElementAccess, isCompoundAssignment, applyParentUnaryOperator);
 }
开发者ID:modulexcite,项目名称:pattern-matching-csharp,代码行数:13,代码来源:LocalRewriter_BinaryOperator.cs

示例15: PromoteOperandTypes

        /// <summary>
        /// Promote the left and right operand types
        /// </summary>
        /// <param name="binaryOperatorKind">the operator kind</param>
        /// <param name="left">the left operand</param>
        /// <param name="right">the right operand</param>
        internal static void PromoteOperandTypes(BinaryOperatorKind binaryOperatorKind, ref SingleValueNode left, ref SingleValueNode right)
        {
            IEdmTypeReference leftType;
            IEdmTypeReference rightType;
            if (!TypePromotionUtils.PromoteOperandTypes(binaryOperatorKind, left, right, out leftType, out rightType))
            {
                string leftTypeName = left.TypeReference == null ? "<null>" : left.TypeReference.FullName();
                string rightTypeName = right.TypeReference == null ? "<null>" : right.TypeReference.FullName();
                throw new ODataException(ODataErrorStrings.MetadataBinder_IncompatibleOperandsError(leftTypeName, rightTypeName, binaryOperatorKind));
            }

            left = MetadataBindingUtils.ConvertToTypeIfNeeded(left, leftType);
            right = MetadataBindingUtils.ConvertToTypeIfNeeded(right, rightType);
        }
开发者ID:larsenjo,项目名称:odata.net,代码行数:20,代码来源:BinaryOperatorBinder.cs


注:本文中的BinaryOperatorKind类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。