• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# EXPRFLAG类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: CMethodIterator

 public CMethodIterator(CSemanticChecker checker, SymbolLoader symLoader, Name name, TypeArray containingTypes, CType @object, CType qualifyingType, Declaration context, bool allowBogusAndInaccessible, bool allowExtensionMethods, int arity, EXPRFLAG flags, symbmask_t mask)
 {
     Debug.Assert(name != null);
     Debug.Assert(symLoader != null);
     Debug.Assert(checker != null);
     Debug.Assert(containingTypes != null);
     _pSemanticChecker = checker;
     _pSymbolLoader = symLoader;
     _pCurrentType = null;
     _pCurrentSym = null;
     _pName = name;
     _pContainingTypes = containingTypes;
     _pQualifyingType = qualifyingType;
     _pContext = context;
     _bAllowBogusAndInaccessible = allowBogusAndInaccessible;
     _bAllowExtensionMethods = allowExtensionMethods;
     _nArity = arity;
     _flags = flags;
     _mask = mask;
     _nCurrentTypeCount = 0;
     _bIsCheckingInstanceMethods = true;
     _bAtEnd = false;
     _bCurrentSymIsBogus = false;
     _bCurrentSymIsInaccessible = false;
     _bcanIncludeExtensionsInResults = _bAllowExtensionMethods;
     _bEndIterationAtCurrentExtensionList = false;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:27,代码来源:MethodIterator.cs


示例2: GetMethodIterator

 public CMethodIterator GetMethodIterator(
     CSemanticChecker pChecker, SymbolLoader pSymLoader, CType pObject, CType pQualifyingType, Declaration pContext, bool allowBogusAndInaccessible, bool allowExtensionMethods, int arity, EXPRFLAG flags, symbmask_t mask)
 {
     Debug.Assert(pSymLoader != null);
     CMethodIterator iterator = new CMethodIterator(pChecker, pSymLoader, _pName, ContainingTypes, pObject, pQualifyingType, pContext, allowBogusAndInaccessible, allowExtensionMethods, arity, flags, mask);
     return iterator;
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:MemberLookupResults.cs


示例3: CreateFunctionPointer

 public EXPRFUNCPTR CreateFunctionPointer(EXPRFLAG nFlags, CType pType, EXPR pObject, MethWithInst MWI)
 {
     Debug.Assert(0 == (nFlags & ~(EXPRFLAG.EXF_BASECALL)));
     EXPRFUNCPTR rval = new EXPRFUNCPTR();
     rval.kind = ExpressionKind.EK_FUNCPTR;
     rval.type = pType;
     rval.flags = nFlags;
     rval.OptionalObject = pObject;
     rval.mwi = new MethWithInst(MWI);
     Debug.Assert(rval != null);
     return (rval);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:12,代码来源:ExprFactory.cs


示例4: CreateField

 public EXPRFIELD CreateField(EXPRFLAG nFlags, CType pType, EXPR pOptionalObject, uint nOffset, FieldWithType FWT, EXPR pOptionalLHS)
 {
     Debug.Assert(0 == (nFlags & ~(EXPRFLAG.EXF_MEMBERSET | EXPRFLAG.EXF_MASK_ANY)));
     EXPRFIELD rval = new EXPRFIELD();
     rval.kind = ExpressionKind.EK_FIELD;
     rval.type = pType;
     rval.flags = nFlags;
     rval.SetOptionalObject(pOptionalObject);
     if (FWT != null)
     {
         rval.fwt = FWT;
     }
     Debug.Assert(rval != null);
     return (rval);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:15,代码来源:ExprFactory.cs


示例5: CreateCall

        public EXPRCALL CreateCall(EXPRFLAG nFlags, CType pType, EXPR pOptionalArguments, EXPRMEMGRP pMemberGroup, MethWithInst MWI)
        {
            Debug.Assert(0 == (nFlags &
               ~(
                   EXPRFLAG.EXF_NEWOBJCALL | EXPRFLAG.EXF_CONSTRAINED | EXPRFLAG.EXF_BASECALL |
                   EXPRFLAG.EXF_NEWSTRUCTASSG |
                   EXPRFLAG.EXF_IMPLICITSTRUCTASSG | EXPRFLAG.EXF_MASK_ANY
               )
              ));

            EXPRCALL rval = new EXPRCALL();
            rval.kind = ExpressionKind.EK_CALL;
            rval.type = pType;
            rval.flags = nFlags;
            rval.SetOptionalArguments(pOptionalArguments);
            rval.SetMemberGroup(pMemberGroup);
            rval.nubLiftKind = NullableCallLiftKind.NotLifted;
            rval.castOfNonLiftedResultToLiftedType = null;

            rval.mwi = MWI;
            Debug.Assert(rval != null);
            return (rval);
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:23,代码来源:ExprFactory.cs


示例6: BindLiftedStandardBinOp

        private EXPR BindLiftedStandardBinOp(BinOpArgInfo info, BinOpFullSig bofs, ExpressionKind ek, EXPRFLAG flags)
        {
            Debug.Assert(bofs.Type1().IsNullableType() || bofs.Type2().IsNullableType());

            EXPR arg1 = info.arg1;
            EXPR arg2 = info.arg2;

            // We want to get the base types of the arguments and attempt to bind the non-lifted form of the
            // method so that we error report (ie divide by zero etc), and then we store in the resulting
            // binop that we have a lifted operator.

            EXPR pArgument1 = null;
            EXPR pArgument2 = null;
            EXPR nonLiftedArg1 = null;
            EXPR nonLiftedArg2 = null;
            EXPR nonLiftedResult = null;
            CType resultType = null;

            LiftArgument(arg1, bofs.Type1(), bofs.ConvertFirst(), out pArgument1, out nonLiftedArg1);
            LiftArgument(arg2, bofs.Type2(), bofs.ConvertSecond(), out pArgument2, out nonLiftedArg2);

            // Now call the non-lifted method to generate errors, and stash the result.
            if (!nonLiftedArg1.isNull() && !nonLiftedArg2.isNull())
            {
                // Only compute the method if theres no nulls. If there are, we'll special case it
                // later, since operations with a null operand are null.
                nonLiftedResult = bofs.pfn(ek, flags, nonLiftedArg1, nonLiftedArg2);
            }

            // Check if we have a comparison. If so, set the result type to bool.
            if (info.binopKind == BinOpKind.Compare || info.binopKind == BinOpKind.Equal)
            {
                resultType = GetReqPDT(PredefinedType.PT_BOOL);
            }
            else
            {
                if (bofs.fnkind == BinOpFuncKind.EnumBinOp)
                {
                    AggregateType enumType;
                    resultType = GetEnumBinOpType(ek, nonLiftedArg1.type, nonLiftedArg2.type, out enumType);
                }
                else
                {
                    resultType = pArgument1.type;
                }
                resultType = resultType.IsNullableType() ? resultType : GetSymbolLoader().GetTypeManager().GetNullable(resultType);
            }

            EXPRBINOP exprRes = GetExprFactory().CreateBinop(ek, resultType, pArgument1, pArgument2);
            mustCast(nonLiftedResult, resultType, 0);
            exprRes.isLifted = true;
            exprRes.flags |= flags;
            Debug.Assert((exprRes.flags & EXPRFLAG.EXF_LVALUE) == 0);

            return exprRes;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:56,代码来源:Operators.cs


示例7: warning

        /*
          Bind an float/double operator: +, -, , /, %, <, >, <=, >=, ==, !=. If both operations are constants, the result
          will be a constant also. op2 can be null for a unary operator. The operands are assumed
          to be already converted to the correct type.
         */
        // We have an intentional divide by 0 there, so disable the warning...
#if _MSC_VER
#pragma warning( disable : 4723 )
#endif
        private EXPR bindFloatOp(ExpressionKind kind, EXPRFLAG flags, EXPR op1, EXPR op2)
        {
            //Debug.Assert(kind.isRelational() || kind.isArithmetic());
            Debug.Assert(op2 == null || op1.type == op2.type);
            Debug.Assert(op1.type.isPredefType(PredefinedType.PT_FLOAT) || op1.type.isPredefType(PredefinedType.PT_DOUBLE));

            EXPR exprRes;
            EXPR opConst1 = op1.GetConst();
            EXPR opConst2 = op2 != null ? op2.GetConst() : null;

            // Check for constants and fold them.
            if (opConst1 != null && (op2 == null || opConst2 != null))
            {
                // Get the operands
                double d1 = opConst1.asCONSTANT().getVal().doubleVal;
                double d2 = opConst2 != null ? opConst2.asCONSTANT().getVal().doubleVal : 0.0;
                double result = 0;      // if isBoolResult is false
                bool result_b = false;  // if isBoolResult is true

                // Do the operation.
                switch (kind)
                {
                    case ExpressionKind.EK_ADD:
                        result = d1 + d2;
                        break;
                    case ExpressionKind.EK_SUB:
                        result = d1 - d2;
                        break;
                    case ExpressionKind.EK_MUL:
                        result = d1 * d2;
                        break;
                    case ExpressionKind.EK_DIV:
                        result = d1 / d2;
                        break;
                    case ExpressionKind.EK_NEG:
                        result = -d1;
                        break;
                    case ExpressionKind.EK_UPLUS:
                        result = d1;
                        break;
                    case ExpressionKind.EK_MOD:
                        result = d1 % d2;
                        break;
                    case ExpressionKind.EK_EQ:
                        result_b = (d1 == d2);
                        break;
                    case ExpressionKind.EK_NE:
                        result_b = (d1 != d2);
                        break;
                    case ExpressionKind.EK_LE:
                        result_b = (d1 <= d2);
                        break;
                    case ExpressionKind.EK_LT:
                        result_b = (d1 < d2);
                        break;
                    case ExpressionKind.EK_GE:
                        result_b = (d1 >= d2);
                        break;
                    case ExpressionKind.EK_GT:
                        result_b = (d1 > d2);
                        break;
                    default:
                        Debug.Assert(false);
                        result = 0.0;  // unexpected operation.
                        break;
                }

                CType typeDest;
                CONSTVAL cv = new CONSTVAL();

                // Allocate the result node.
                if (kind.isRelational())
                {
                    cv.iVal = result_b ? 1 : 0;
                    typeDest = GetReqPDT(PredefinedType.PT_BOOL);
                }
                else
                {
                    // NaN has some implementation defined bits that differ between platforms.
                    // Normalize it to produce identical images across all platforms
                    /*
                     * How do we get here?
                    if (_isnan(result))
                    {
                        cv = ConstValFactory.GetNan();
                    }
                    else
                    {
                     * */
                    cv = GetExprConstants().Create(result);

//.........这里部分代码省略.........
开发者ID:ESgarbi,项目名称:corefx,代码行数:101,代码来源:Operators.cs


示例8: BindIntOp

        /*
            Convert and constant fold an expression involving I4, U4, I8 or U8 operands. The operands are
            assumed to be already converted to the correct types.
        */
        private EXPR BindIntOp(ExpressionKind kind, EXPRFLAG flags, EXPR op1, EXPR op2, PredefinedType ptOp)
        {
            //Debug.Assert(kind.isRelational() || kind.isArithmetic() || kind.isBitwise());
            Debug.Assert(ptOp == PredefinedType.PT_INT || ptOp == PredefinedType.PT_UINT || ptOp == PredefinedType.PT_LONG || ptOp == PredefinedType.PT_ULONG);
            CType typeOp = GetReqPDT(ptOp);
            Debug.Assert(typeOp != null);
            Debug.Assert(op1 != null && op1.type == typeOp);
            Debug.Assert(op2 == null || op2.type == typeOp);
            Debug.Assert((op2 == null) == (kind == ExpressionKind.EK_NEG || kind == ExpressionKind.EK_UPLUS || kind == ExpressionKind.EK_BITNOT));

            if (isDivByZero(kind, op2))
            {
                GetErrorContext().Error(ErrorCode.ERR_IntDivByZero);
                EXPR rval = GetExprFactory().CreateBinop(kind, typeOp, op1, op2);
                rval.SetError();
                return rval;
            }

            // This optimization CANNOT be moved to a later pass.  See comments in
            // FoldIntegerConstants.
            EXPR exprFolded = FoldIntegerConstants(kind, flags, op1, op2, ptOp);
            if (exprFolded != null)
            {
                return exprFolded;
            }

            if (kind == ExpressionKind.EK_NEG)
            {
                return BindIntegerNeg(flags, op1, ptOp);
            }

            CType typeDest = kind.isRelational() ? GetReqPDT(PredefinedType.PT_BOOL) : typeOp;

            EXPR exprRes = GetExprFactory().CreateOperator(kind, typeDest, op1, op2);
            exprRes.flags |= flags;
            Debug.Assert((exprRes.flags & EXPRFLAG.EXF_LVALUE) == 0);
            return exprRes;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:42,代码来源:Operators.cs


示例9: GetBinopKindAndFlags

 /*
     Given a binary operator EXPRKIND, get the BinOpKind and flags.
 */
 private bool GetBinopKindAndFlags(ExpressionKind ek, out BinOpKind pBinopKind, out EXPRFLAG flags)
 {
     flags = 0;
     switch (ek)
     {
         case ExpressionKind.EK_ADD:
             if (Context.CheckedNormal)
             {
                 flags |= EXPRFLAG.EXF_CHECKOVERFLOW;
             }
             pBinopKind = BinOpKind.Add;
             break;
         case ExpressionKind.EK_SUB:
             if (Context.CheckedNormal)
             {
                 flags |= EXPRFLAG.EXF_CHECKOVERFLOW;
             }
             pBinopKind = BinOpKind.Sub;
             break;
         case ExpressionKind.EK_DIV:
         case ExpressionKind.EK_MOD:
             // EXPRKIND.EK_DIV and EXPRKIND.EK_MOD need to be treated special for hasSideEffects, 
             // hence the EXPRFLAG.EXF_ASSGOP. Yes, this is a hack.
             flags |= EXPRFLAG.EXF_ASSGOP;
             if (Context.CheckedNormal)
             {
                 flags |= EXPRFLAG.EXF_CHECKOVERFLOW;
             }
             pBinopKind = BinOpKind.Mul;
             break;
         case ExpressionKind.EK_MUL:
             if (Context.CheckedNormal)
             {
                 flags |= EXPRFLAG.EXF_CHECKOVERFLOW;
             }
             pBinopKind = BinOpKind.Mul;
             break;
         case ExpressionKind.EK_BITAND:
         case ExpressionKind.EK_BITOR:
             pBinopKind = BinOpKind.Bitwise;
             break;
         case ExpressionKind.EK_BITXOR:
             pBinopKind = BinOpKind.BitXor;
             break;
         case ExpressionKind.EK_LSHIFT:
         case ExpressionKind.EK_RSHIFT:
             pBinopKind = BinOpKind.Shift;
             break;
         case ExpressionKind.EK_LOGOR:
         case ExpressionKind.EK_LOGAND:
             pBinopKind = BinOpKind.Logical;
             break;
         case ExpressionKind.EK_LT:
         case ExpressionKind.EK_LE:
         case ExpressionKind.EK_GT:
         case ExpressionKind.EK_GE:
             pBinopKind = BinOpKind.Compare;
             break;
         case ExpressionKind.EK_EQ:
         case ExpressionKind.EK_NE:
             pBinopKind = BinOpKind.Equal;
             break;
         default:
             VSFAIL("Bad ek");
             pBinopKind = BinOpKind.Add;
             return false;
     }
     return true;
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:72,代码来源:Operators.cs


示例10: operator

        /*
            Handles enum unary operator (~).
        */
        private EXPR BindEnumUnaOp(ExpressionKind ek, EXPRFLAG flags, EXPR arg)
        {
            Debug.Assert(ek == ExpressionKind.EK_BITNOT);
            Debug.Assert(arg.isCAST());
            Debug.Assert(arg.asCAST().GetArgument().type.isEnumType());

            PredefinedType ptOp;
            CType typeEnum = arg.asCAST().GetArgument().type;

            switch (typeEnum.fundType())
            {
                default:
                    // Promote all smaller types to int.
                    ptOp = PredefinedType.PT_INT;
                    break;
                case FUNDTYPE.FT_U4:
                    ptOp = PredefinedType.PT_UINT;
                    break;
                case FUNDTYPE.FT_I8:
                    ptOp = PredefinedType.PT_LONG;
                    break;
                case FUNDTYPE.FT_U8:
                    ptOp = PredefinedType.PT_ULONG;
                    break;
            }

            CType typeOp = GetReqPDT(ptOp);
            arg = mustCast(arg, typeOp, CONVERTTYPE.NOUDC);

            EXPR exprRes = BindIntOp(ek, flags, arg, null, ptOp);

            if (!exprRes.isOK())
            {
                return exprRes;
            }

            return mustCastInUncheckedContext(exprRes, typeEnum, CONVERTTYPE.NOUDC);
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:41,代码来源:Operators.cs


示例11: BindStrBinOp

 /*
     Handles string concatenation.
 */
 private EXPR BindStrBinOp(ExpressionKind ek, EXPRFLAG flags, EXPR arg1, EXPR arg2)
 {
     Debug.Assert(ek == ExpressionKind.EK_ADD);
     Debug.Assert(arg1.type.isPredefType(PredefinedType.PT_STRING) || arg2.type.isPredefType(PredefinedType.PT_STRING));
     return bindStringConcat(arg1, arg2);
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:9,代码来源:Operators.cs


示例12: BindDecUnaOp

        /*
            Handles standard unary decimal based operators.
        */
        private EXPR BindDecUnaOp(ExpressionKind ek, EXPRFLAG flags, EXPR arg)
        {
            Debug.Assert(arg.type.isPredefType(PredefinedType.PT_DECIMAL));
            Debug.Assert(ek == ExpressionKind.EK_NEG || ek == ExpressionKind.EK_UPLUS);

            CType typeDec = GetOptPDT(PredefinedType.PT_DECIMAL);
            Debug.Assert(typeDec != null);
            ek = ek == ExpressionKind.EK_NEG ? ExpressionKind.EK_DECIMALNEG : ExpressionKind.EK_UPLUS;

            // We want to fold if the argument is constant. Otherwise, keep the regular op.
            EXPR argConst = arg.GetConst();
            if (argConst == null) // Non-constant.
            {
                if (ek == ExpressionKind.EK_DECIMALNEG)
                {
                    PREDEFMETH predefMeth = PREDEFMETH.PM_DECIMAL_OPUNARYMINUS;
                    return CreateUnaryOpForPredefMethodCall(ek, predefMeth, typeDec, arg);
                }
                return GetExprFactory().CreateUnaryOp(ek, typeDec, arg);
            }

            // If its a uplus, just return it.
            if (ek == ExpressionKind.EK_UPLUS)
            {
                return arg;
            }

            decimal dec = argConst.asCONSTANT().getVal().decVal;
            dec = dec * -1;

            // Allocate the result node.
            CONSTVAL cv = GetExprConstants().Create(dec);

            EXPR exprRes = GetExprFactory().CreateConstant(typeDec, cv);

            return exprRes;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:40,代码来源:Operators.cs


示例13: EE

        /*
            Handles standard binary decimal based operators.
            This function is called twice by the EE for every binary operator it evaluates
            Here is how it works.
        1.  The EE on finding an Expr asks the Expression binder to bind it. 
        2.  At this time the expression binder just creates a new binopexpr and returns it to the EE,
        the EE then uses the runtimesystem to find if any of the arguments of the expr can be evaluated to constants.
        3.  If so it creates new arguments and expr, aliases the original expr to the new one and passes
        it new expr to Expressionbinder to be bound. 
        4.  This time the expression binder realizes that the 2 arguments are constants and tries to fold them.
        If the folding is successful the value is used by the EE (and we have avoided a funceval)
        5.  if the constant binding fails, then the Expression binders returns the same exp as it would have 
        created for the compile case ( we func eval the same function as what would be executed at runtime).
        */
        private EXPR BindDecBinOp(ExpressionKind ek, EXPRFLAG flags, EXPR arg1, EXPR arg2)
        {
            Debug.Assert(arg1.type.isPredefType(PredefinedType.PT_DECIMAL) && arg2.type.isPredefType(PredefinedType.PT_DECIMAL));

            CType typeDec = GetOptPDT(PredefinedType.PT_DECIMAL);
            Debug.Assert(typeDec != null);

            EXPR argConst1 = arg1.GetConst();
            EXPR argConst2 = arg2.GetConst();

            CType typeRet = null;

            switch (ek)
            {
                default:
                    VSFAIL("Bad kind");
                    break;
                case ExpressionKind.EK_ADD:
                case ExpressionKind.EK_SUB:
                case ExpressionKind.EK_MUL:
                case ExpressionKind.EK_DIV:
                case ExpressionKind.EK_MOD:
                    typeRet = typeDec;
                    break;
                case ExpressionKind.EK_LT:
                case ExpressionKind.EK_LE:
                case ExpressionKind.EK_GT:
                case ExpressionKind.EK_GE:
                case ExpressionKind.EK_EQ:
                case ExpressionKind.EK_NE:
                    typeRet = GetReqPDT(PredefinedType.PT_BOOL);
                    break;
            }

#if CSEE
            // In the EE, even if we don't have two constants, we want to emit an EXPRBINOP with the
            // right EK so that when we evalsync we can just do the work ourselves instead of
            // delegating to method calls.

            if (!argConst1 || !argConst2)
            {
                // We don't have 2 constants, so just emit an EXPRBINOP...
                return GetExprFactory().CreateBinop(tree, ek, typeRet, arg1, arg2);
            }
            else
            {
                goto LBothConst;
            }

        LUserDefined:

#endif // CSEE

#if !CSEE
            if (argConst2 != null && argConst1 != null)
            {
                goto LBothConst;
            }
#endif

            // At this point, for the compiler we don't want to optimize the binop just yet. Maintain the correct tree until
            // the arithmetic optimizer pass.
            return GetExprFactory().CreateBinop(ek, typeRet, arg1, arg2);

        LBothConst:
            decimal dec1;
            decimal dec2;
            decimal decRes = 0;
            bool fRes = false;
            bool fBool = false;

            dec1 = argConst1.asCONSTANT().getVal().decVal;
            dec2 = argConst2.asCONSTANT().getVal().decVal;

            // Do the operation.
            switch (ek)
            {
                case ExpressionKind.EK_ADD:
                    decRes = dec1 + dec2;
                    break;
                case ExpressionKind.EK_SUB:
                    decRes = dec1 - dec2;
                    break;
                case ExpressionKind.EK_MUL:
                    decRes = dec1 * dec2;
                    break;
//.........这里部分代码省略.........
开发者ID:ESgarbi,项目名称:corefx,代码行数:101,代码来源:Operators.cs


示例14: BindLiftedIncOp

        private EXPRMULTI BindLiftedIncOp(ExpressionKind ek, EXPRFLAG flags, EXPR arg, UnaOpFullSig uofs)
        {
            Debug.Assert(ek == ExpressionKind.EK_ADD || ek == ExpressionKind.EK_SUB);
            Debug.Assert(uofs.isLifted());

            NullableType type = uofs.GetType().AsNullableType();
            Debug.Assert(arg != null);
            EXPR exprVal;

#if ! CSEE
            EXPRMULTIGET exprGet = GetExprFactory().CreateMultiGet(EXPRFLAG.EXF_ASSGOP, arg.type, null);
            exprVal = exprGet;
#else
            exprVal = arg;
#endif

            EXPR nonLiftedResult = null;
            EXPR nonLiftedArg = exprVal;

            // We want to give the lifted argument as the binop, but use the non-lifted argument as the 
            // argument of the call.
            //Debug.Assert(uofs.LiftArg() || type.IsValType());
            nonLiftedArg = mustCast(nonLiftedArg, type.GetUnderlyingType());
            nonLiftedResult = BindIncOpCore(ek, flags, nonLiftedArg, type.GetUnderlyingType());
            exprVal = mustCast(exprVal, type);
            EXPRUNARYOP exprRes = GetExprFactory().CreateUnaryOp((ek == ExpressionKind.EK_ADD) ? ExpressionKind.EK_INC : ExpressionKind.EK_DEC, arg.type/* type */, exprVal);
            mustCast(mustCast(nonLiftedResult, type), arg.type);
            exprRes.flags |= flags;

            EXPRMULTI exprMulti = GetExprFactory().CreateMulti(EXPRFLAG.EXF_ASSGOP | flags, arg.type, arg, exprRes);

#if ! CSEE
            exprGet.SetOptionalMulti(exprMulti);
#endif
            return exprMulti;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:36,代码来源:Operators.cs


示例15: BindNonliftedIncOp

        private EXPRMULTI BindNonliftedIncOp(ExpressionKind ek, EXPRFLAG flags, EXPR arg, UnaOpFullSig uofs)
        {
            Debug.Assert(ek == ExpressionKind.EK_ADD || ek == ExpressionKind.EK_SUB);
            Debug.Assert(!uofs.isLifted());

            Debug.Assert(arg != null);
            EXPR exprVal;
#if ! CSEE
            EXPRMULTIGET exprGet = GetExprFactory().CreateMultiGet(EXPRFLAG.EXF_ASSGOP, arg.type, null);
            exprVal = exprGet;
#else
            exprVal = arg;
#endif

            CType type = uofs.GetType();
            Debug.Assert(!type.IsNullableType());

            // These used to be converts, but we're making them casts now - this is because
            // we need to remove the ability to call inc(sbyte) etc for all types smaller than int. 
            // Note however, that this will give us different error messages on compile time versus runtime
            // for checked increments.
            //
            // Also, we changed it so that we now generate the cast to and from enum for enum increments.
            exprVal = mustCast(exprVal, type);
            exprVal = BindIncOpCore(ek, flags, exprVal, type);
            EXPR op = mustCast(exprVal, arg.type, CONVERTTYPE.NOUDC);

            EXPRMULTI exprMulti = GetExprFactory().CreateMulti(EXPRFLAG.EXF_ASSGOP | flags, arg.type, arg, op);

#if ! CSEE
            exprGet.SetOptionalMulti(exprMulti);
#endif
            return exprMulti;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:34,代码来源:Operators.cs


示例16: BindDelBinOp

        /*
            Handles delegate binary operators.
        */
        private EXPR BindDelBinOp(ExpressionKind ek, EXPRFLAG flags, EXPR arg1, EXPR arg2)
        {
            Debug.Assert(ek == ExpressionKind.EK_ADD || ek == ExpressionKind.EK_SUB || ek == ExpressionKind.EK_EQ || ek == ExpressionKind.EK_NE);
            Debug.Assert(arg1.type == arg2.type && (arg1.type.isDelegateType() || arg1.type.isPredefType(PredefinedType.PT_DELEGATE)));

            PREDEFMETH predefMeth = (PREDEFMETH)0;
            CType RetType = null;
            switch (ek)
            {
                case ExpressionKind.EK_ADD:
                    predefMeth = PREDEFMETH.PM_DELEGATE_COMBINE;
                    RetType = arg1.type;
                    ek = ExpressionKind.EK_DELEGATEADD;
                    break;

                case ExpressionKind.EK_SUB:
                    predefMeth = PREDEFMETH.PM_DELEGATE_REMOVE;
                    RetType = arg1.type;
                    ek = ExpressionKind.EK_DELEGATESUB;
                    break;

                case ExpressionKind.EK_EQ:
                    predefMeth = PREDEFMETH.PM_DELEGATE_OPEQUALITY;
                    RetType = GetReqPDT(PredefinedType.PT_BOOL);
                    ek = ExpressionKind.EK_DELEGATEEQ;
                    break;

                case ExpressionKind.EK_NE:
                    predefMeth = PREDEFMETH.PM_DELEGATE_OPINEQUALITY;
                    RetType = GetReqPDT(PredefinedType.PT_BOOL);
                    ek = ExpressionKind.EK_DELEGATENE;
                    break;
            }
            return CreateBinopForPredefMethodCall(ek, predefMeth, RetType, arg1, arg2);
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:38,代码来源:Operators.cs


示例17: BindEnumBinOp

        /*
            Handles enum binary operators.
        */
        private EXPR BindEnumBinOp(ExpressionKind ek, EXPRFLAG flags, EXPR arg1, EXPR arg2)
        {
            AggregateType typeEnum = null;
            AggregateType typeDst = GetEnumBinOpType(ek, arg1.type, arg2.type, out typeEnum);

            Debug.Assert(typeEnum != null);
            PredefinedType ptOp;

            switch (typeEnum.fundType())
            {
                default:
                    // Promote all smaller types to int.
                    ptOp = PredefinedType.PT_INT;
                    break;
                case FUNDTYPE.FT_U4:
                    ptOp = PredefinedType.PT_UINT;
                    break;
                case FUNDTYPE.FT_I8:
                    ptOp = PredefinedType.PT_LONG;
                    break;
                case FUNDTYPE.FT_U8:
                    ptOp = PredefinedType.PT_ULONG;
                    break;
            }

            CType typeOp = GetReqPDT(ptOp);
            arg1 = mustCast(arg1, typeOp, CONVERTTYPE.NOUDC);
            arg2 = mustCast(arg2, typeOp, CONVERTTYPE.NOUDC);

            EXPR exprRes = BindIntOp(ek, flags, arg1, arg2, ptOp);

            if (!exprRes.isOK())
            {
                return exprRes;
            }

            if (exprRes.type != typeDst)
            {
                Debug.Assert(!typeDst.isPredefType(PredefinedType.PT_BOOL));
                exprRes = mustCast(exprRes, typeDst, CONVERTTYPE.NOUDC);
            }

            return exprRes;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:47,代码来源:Operators.cs


示例18: BindShiftOp

        /*
            Bind a shift operator: <<, >>. These can have integer or long first operands,
            and second operand must be int.
        */
        private EXPR BindShiftOp(ExpressionKind ek, EXPRFLAG flags, EXPR arg1, EXPR arg2)
        {
            Debug.Assert(ek == ExpressionKind.EK_LSHIFT || ek == ExpressionKind.EK_RSHIFT);
            Debug.Assert(arg1.type.isPredefined());
            Debug.Assert(arg2.type.isPredefType(PredefinedType.PT_INT));

            PredefinedType ptOp = arg1.type.getPredefType();
            Debug.Assert(ptOp == PredefinedType.PT_INT || ptOp == PredefinedType.PT_UINT || ptOp == PredefinedType.PT_LONG || ptOp == PredefinedType.PT_ULONG);

            // We want to check up front if we have two constants, because constant folding is supposed to
            // happen in the initial binding pass.
            EXPR argConst1 = arg1.GetConst();
            EXPR argConst2 = arg2.GetConst();

            if (argConst1 == null || argConst2 == null) // One or more aren't constants, so don't fold anything.
            {
                return GetExprFactory().CreateBinop(ek, arg1.type, arg1, arg2);
            }

            // Both constants, so fold them.
            CONSTVAL cv = new CONSTVAL();
            int cbit = (ptOp == PredefinedType.PT_LONG || ptOp == PredefinedType.PT_ULONG) ? 0x3f : 0x1f;
            cv.iVal = argConst2.asCONSTANT().getVal().iVal & cbit;
            cbit = cv.iVal;

            // Fill in the CONSTVAL.
            if (ptOp == PredefinedType.PT_LONG || ptOp == PredefinedType.PT_ULONG)
            {
                Debug.Assert(0 <= cbit && cbit < 0x40);
                ulong u1 = argConst1.asCONSTANT().getVal().ulongVal;
                ulong uval;

                switch (ek)
                {
                    case ExpressionKind.EK_LSHIFT:
                        uval = u1 << cbit;
                        break;
                    case ExpressionKind.EK_RSHIFT:
                        uval = (ptOp == PredefinedType.PT_LONG) ? (ulong)((long)u1 >> cbit) : (u1 >> cbit);
                        break;
                    default:
                        VSFAIL("Unknown op");
                        uval = 0;
                        break;
                }
                cv = GetExprConstants().Create(uval);
            }
            else
            {
                Debug.Assert(0 <= cbit && cbit < 0x20);
                uint u1 = argConst1.asCONSTANT().getVal().uiVal;

                switch (ek)
                {
                    case ExpressionKind.EK_LSHIFT:
                        cv.uiVal = u1 << cbit;
                        break;
                    case ExpressionKind.EK_RSHIFT:
                        cv.uiVal = (ptOp == PredefinedType.PT_INT) ? (uint)((int)u1 >> cbit) : (u1 >> cbit);
                        break;
                    default:
                        VSFAIL("Unknown op");
                        cv.uiVal = 0;
                        break;
                }
            }

            EXPR exprRes = GetExprFactory().CreateConstant(GetReqPDT(ptOp), cv);
            return exprRes;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:74,代码来源:Operators.cs


示例19: BindPtrCmpOp

 /*
     Handles pointer comparison operators.
 */
 private EXPR BindPtrCmpOp(ExpressionKind ek, EXPRFLAG flags, EXPR arg1, EXPR arg2)
 {
     return null;
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:7,代码来源:Operators.cs


示例20: BindBoolBinOp

        /*
            Bind a bool binary operator: ==, !=, &&, ||, , |, ^. If both operands are constant, the
            result will be a constant also.
        */
        private EXPR BindBoolBinOp(ExpressionKind ek, EXPRFLAG flags, EXPR arg1, EXPR arg2)
        {
            Debug.Assert(arg1 != null);
            Debug.Assert(arg2 != null);
            Debug.Assert(arg1.type.isPredefType(PredefinedType.PT_BOOL) || (arg1.type.IsNullableType() && arg2.type.AsNullableType().GetUnderlyingType().isPredefType(PredefinedType.PT_BOOL)));
            Debug.Assert(arg2.type.isPredefType(PredefinedType.PT_BOOL) || (arg2.type.IsNullableType() && arg2.type.AsNullableType().GetUnderlyingType().isPredefType(PredefinedType.PT_BOOL)));

            EXPR exprRes = GetExprFactory().CreateBinop(ek, GetReqPDT(PredefinedType.PT_BOOL), arg1, arg2);

            return exprRes;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:15,代码来源:Operators.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# EZDragDropDelegate类代码示例发布时间:2022-05-24
下一篇:
C# EVRSettingsError类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap