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

C# Semantics.EXPR类代码示例

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

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



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

示例1: StripNullableConstructor

 public static EXPR StripNullableConstructor(EXPR pExpr)
 {
     while (IsNullableConstructor(pExpr))
     {
         Debug.Assert(pExpr.isCALL());
         pExpr = pExpr.asCALL().GetOptionalArguments();
         Debug.Assert(pExpr != null && !pExpr.isLIST());
     }
     return pExpr;
 }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:10,代码来源:Nullable.cs


示例2: Dispatch

        protected override EXPR Dispatch(EXPR expr)
        {
            Debug.Assert(expr != null);

            EXPR result = base.Dispatch(expr);
            if (result == expr)
            {
                throw Error.InternalCompilerError();
            }
            return result;
        }
开发者ID:dotnet,项目名称:corefx,代码行数:11,代码来源:ExpressionTreeRewriter.cs


示例3: ImplicitConversion

 public ImplicitConversion(ExpressionBinder binder, EXPR exprSrc, CType typeSrc, EXPRTYPEORNAMESPACE typeDest, bool needsExprDest, CONVERTTYPE flags)
 {
     _binder = binder;
     _exprSrc = exprSrc;
     _typeSrc = typeSrc;
     _typeDest = typeDest.TypeOrNamespace.AsType();
     _exprTypeDest = typeDest;
     _needsExprDest = needsExprDest;
     _flags = flags;
     _exprDest = null;
 }
开发者ID:dotnet,项目名称:corefx,代码行数:11,代码来源:ImplicitConversion.cs


示例4: 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


示例5: ExplicitConversion

            // ----------------------------------------------------------------------------
            // BindExplicitConversion
            // ----------------------------------------------------------------------------

            public ExplicitConversion(ExpressionBinder binder, EXPR exprSrc, CType typeSrc, EXPRTYPEORNAMESPACE typeDest, CType pDestinationTypeForLambdaErrorReporting, bool needsExprDest, CONVERTTYPE flags)
            {
                _binder = binder;
                _exprSrc = exprSrc;
                _typeSrc = typeSrc;
                _typeDest = typeDest.TypeOrNamespace.AsType();
                _pDestinationTypeForLambdaErrorReporting = pDestinationTypeForLambdaErrorReporting;
                _exprTypeDest = typeDest;
                _needsExprDest = needsExprDest;
                _flags = flags;
                _exprDest = null;
            }
开发者ID:noahfalk,项目名称:corefx,代码行数:16,代码来源:ExplicitConversion.cs


示例6: 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


示例7: BinOpArgInfo

 public BinOpArgInfo(EXPR op1, EXPR op2)
 {
     Debug.Assert(op1 != null);
     Debug.Assert(op2 != null);
     arg1 = op1;
     arg2 = op2;
     type1 = arg1.type;
     type2 = arg2.type;
     typeRaw1 = type1.StripNubs();
     typeRaw2 = type2.StripNubs();
     pt1 = type1.isPredefined() ? type1.getPredefType() : PredefinedType.PT_COUNT;
     pt2 = type2.isPredefined() ? type2.getPredefType() : PredefinedType.PT_COUNT;
     ptRaw1 = typeRaw1.isPredefined() ? typeRaw1.getPredefType() : PredefinedType.PT_COUNT;
     ptRaw2 = typeRaw2.isPredefined() ? typeRaw2.getPredefType() : PredefinedType.PT_COUNT;
 }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:15,代码来源:BinOpArgInfo.cs


示例8: Visit

        public EXPR Visit(EXPR pExpr)
        {
            if (pExpr == null)
            {
                return null;
            }

            EXPR pResult;
            if (IsCachedExpr(pExpr, out pResult))
            {
                return pResult;
            }

            if (pExpr.isSTMT())
            {
                return CacheExprMapping(pExpr, DispatchStatementList(pExpr.asSTMT()));
            }

            return CacheExprMapping(pExpr, Dispatch(pExpr));
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:20,代码来源:ExprVisitorBase.cs


示例9: BindValue

        // Value
        public EXPR BindValue(EXPR exprSrc)
        {
            Debug.Assert(exprSrc != null && exprSrc.type.IsNullableType());

            // For new T?(x), the answer is x.
            if (CNullable.IsNullableConstructor(exprSrc))
            {
                Debug.Assert(exprSrc.asCALL().GetOptionalArguments() != null && !exprSrc.asCALL().GetOptionalArguments().isLIST());
                return exprSrc.asCALL().GetOptionalArguments();
            }

            CType typeBase = exprSrc.type.AsNullableType().GetUnderlyingType();
            AggregateType ats = exprSrc.type.AsNullableType().GetAts(GetErrorContext());
            if (ats == null)
            {
                EXPRPROP rval = GetExprFactory().CreateProperty(typeBase, exprSrc);
                rval.SetError();
                return rval;
            }

            PropertySymbol prop = GetSymbolLoader().getBSymmgr().propNubValue;
            if (prop == null)
            {
                prop = GetSymbolLoader().getPredefinedMembers().GetProperty(PREDEFPROP.PP_G_OPTIONAL_VALUE);
                GetSymbolLoader().getBSymmgr().propNubValue = prop;
            }

            PropWithType pwt = new PropWithType(prop, ats);
            MethWithType mwt = new MethWithType(prop != null ? prop.methGet : null, ats);
            MethPropWithInst mpwi = new MethPropWithInst(prop, ats);
            EXPRMEMGRP pMemGroup = GetExprFactory().CreateMemGroup(exprSrc, mpwi);
            EXPRPROP exprRes = GetExprFactory().CreateProperty(typeBase, null, null, pMemGroup, pwt, mwt, null);

            if (prop == null)
            {
                exprRes.SetError();
            }

            return exprRes;
        }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:41,代码来源:Nullable.cs


示例10: IsNullableConstructor

        public static bool IsNullableConstructor(EXPR expr)
        {
            Debug.Assert(expr != null);

            if (!expr.isCALL())
            {
                return false;
            }

            EXPRCALL pCall = expr.asCALL();
            if (pCall.GetMemberGroup().GetOptionalObject() != null)
            {
                return false;
            }

            MethodSymbol meth = pCall.mwi.Meth();
            if (meth == null)
            {
                return false;
            }
            return meth.IsNullableConstructor();
        }
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:22,代码来源:Nullable.cs


示例11: 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


示例12: Rewrite

        /////////////////////////////////////////////////////////////////////////////////

        public static Expression Rewrite(TypeManager typeManager, EXPR pExpr, IEnumerable<Expression> listOfParameters)
        {
            ExpressionTreeCallRewriter rewriter = new ExpressionTreeCallRewriter(typeManager, listOfParameters);

            // We should have a EXPRBINOP thats an EK_SEQUENCE. The RHS of our sequence
            // should be a call to PM_EXPRESSION_LAMBDA. The LHS of our sequence is the 
            // set of declarations for the parameters that we'll need.
            // Assert all of these first, and then unwrap them.

            Debug.Assert(pExpr != null);
            Debug.Assert(pExpr.isBIN());
            Debug.Assert(pExpr.kind == ExpressionKind.EK_SEQUENCE);
            Debug.Assert(pExpr.asBIN().GetOptionalRightChild() != null);
            Debug.Assert(pExpr.asBIN().GetOptionalRightChild().isCALL());
            Debug.Assert(pExpr.asBIN().GetOptionalRightChild().asCALL().PredefinedMethod == PREDEFMETH.PM_EXPRESSION_LAMBDA);
            Debug.Assert(pExpr.asBIN().GetOptionalLeftChild() != null);

            // Visit the left to generate the parameter construction.
            rewriter.Visit(pExpr.asBIN().GetOptionalLeftChild());
            EXPRCALL call = pExpr.asBIN().GetOptionalRightChild().asCALL();

            ExpressionEXPR e = rewriter.Visit(call) as ExpressionEXPR;
            return e.Expression;
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:26,代码来源:ExpressionTreeCallRewriter.cs


示例13: IsDelegateConstructorCall

 protected bool IsDelegateConstructorCall(EXPR pExpr)
 {
     Debug.Assert(pExpr != null);
     if (!pExpr.isCALL())
     {
         return false;
     }
     EXPRCALL pCall = pExpr.asCALL();
     return pCall.mwi.Meth() != null &&
         pCall.mwi.Meth().IsConstructor() &&
         pCall.type.isDelegateType() &&
         pCall.GetOptionalArguments() != null &&
         pCall.GetOptionalArguments().isLIST() &&
         pCall.GetOptionalArguments().asLIST().GetOptionalNextListNode().kind == ExpressionKind.EK_FUNCPTR;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:15,代码来源:ExpressionTreeRewriter.cs


示例14: IsNullableValueAccess

 protected bool IsNullableValueAccess(EXPR pExpr, EXPR pObject)
 {
     Debug.Assert(pExpr != null);
     return pExpr.isPROP() && (pExpr.asPROP().GetMemberGroup().GetOptionalObject() == pObject) && pObject.type.IsNullableType();
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:5,代码来源:ExpressionTreeRewriter.cs


示例15: FixLiftedUserDefinedBinaryOperators

        protected void FixLiftedUserDefinedBinaryOperators(EXPRBINOP expr, ref EXPR pp1, ref EXPR pp2)
        {
            // If we have lifted T1 op T2 to T1? op T2?, and we have an expression T1 op T2? or T1? op T2 then
            // we need to ensure that the unlifted actual arguments are promoted to their nullable CType.
            Debug.Assert(expr != null);
            Debug.Assert(pp1 != null);
            Debug.Assert(pp1 != null);
            Debug.Assert(pp2 != null);
            Debug.Assert(pp2 != null);
            MethodSymbol method = expr.GetUserDefinedCallMethod().Meth();
            EXPR orig1 = expr.GetOptionalLeftChild();
            EXPR orig2 = expr.GetOptionalRightChild();
            Debug.Assert(orig1 != null && orig2 != null);
            EXPR new1 = pp1;
            EXPR new2 = pp2;
            CType fptype1 = method.Params.Item(0);
            CType fptype2 = method.Params.Item(1);
            CType aatype1 = orig1.type;
            CType aatype2 = orig2.type;
            // Is the operator even a candidate for lifting?
            if (fptype1.IsNullableType() || fptype2.IsNullableType() ||
                !fptype1.IsAggregateType() || !fptype2.IsAggregateType() ||
                !fptype1.AsAggregateType().getAggregate().IsValueType() ||
                !fptype2.AsAggregateType().getAggregate().IsValueType())
            {
                return;
            }
            CType nubfptype1 = GetSymbolLoader().GetTypeManager().GetNullable(fptype1);
            CType nubfptype2 = GetSymbolLoader().GetTypeManager().GetNullable(fptype2);
            // If we have null op X, or T1 op T2?, or T1 op null, lift first arg to T1?
            if (aatype1.IsNullType() || aatype1 == fptype1 && (aatype2 == nubfptype2 || aatype2.IsNullType()))
            {
                new1 = GenerateCall(PREDEFMETH.PM_EXPRESSION_CONVERT, new1, CreateTypeOf(nubfptype1));
            }

            // If we have X op null, or T1? op T2, or null op T2, lift second arg to T2?
            if (aatype2.IsNullType() || aatype2 == fptype2 && (aatype1 == nubfptype1 || aatype1.IsNullType()))
            {
                new2 = GenerateCall(PREDEFMETH.PM_EXPRESSION_CONVERT, new2, CreateTypeOf(nubfptype2));
            }
            pp1 = new1;
            pp2 = new2;
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:43,代码来源:ExpressionTreeRewriter.cs


示例16: GenerateParamsArray

 protected virtual EXPRARRINIT GenerateParamsArray(EXPR args, PredefinedType pt)
 {
     int parameterCount = ExpressionIterator.Count(args);
     AggregateType paramsArrayElementType = GetSymbolLoader().GetOptPredefTypeErr(pt, true);
     ArrayType paramsArrayType = GetSymbolLoader().GetTypeManager().GetArray(paramsArrayElementType, 1);
     EXPRCONSTANT paramsArrayArg = GetExprFactory().CreateIntegerConstant(parameterCount);
     EXPRARRINIT arrayInit = GetExprFactory().CreateArrayInit(EXPRFLAG.EXF_CANTBENULL, paramsArrayType, args, paramsArrayArg, null);
     arrayInit.dimSize = parameterCount;
     arrayInit.dimSizes = new int[] { arrayInit.dimSize }; // CLEANUP: Why isn't this done by the factory?
     return arrayInit;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:11,代码来源:ExpressionTreeRewriter.cs


示例17: DestroyWraps

 protected EXPR DestroyWraps(EXPRBOUNDLAMBDA anonmeth, EXPR sequence)
 {
     for (Symbol sym = anonmeth.ArgumentScope(); sym != null; sym = sym.nextChild)
     {
         if (!sym.IsLocalVariableSymbol())
         {
             continue;
         }
         LocalVariableSymbol local = sym.AsLocalVariableSymbol();
         if (local.isThis)
         {
             continue;
         }
         Debug.Assert(local.wrap != null);
         Debug.Assert(anonmeth.OptionalBody != null);
         EXPR freeWrap = GetExprFactory().CreateWrap(anonmeth.OptionalBody.OptionalScopeSymbol, local.wrap);
         sequence = GetExprFactory().CreateReverseSequence(sequence, freeWrap);
     }
     return sequence;
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:20,代码来源:ExpressionTreeRewriter.cs


示例18: GenerateValueAccessConversion

 protected virtual EXPR GenerateValueAccessConversion(EXPR pArgument)
 {
     Debug.Assert(pArgument != null);
     CType pStrippedTypeOfArgument = pArgument.type.StripNubs();
     EXPR pStrippedTypeExpr = CreateTypeOf(pStrippedTypeOfArgument);
     return GenerateCall(PREDEFMETH.PM_EXPRESSION_CONVERT, Visit(pArgument), pStrippedTypeExpr);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:7,代码来源:ExpressionTreeRewriter.cs


示例19: GenerateConversion

 protected virtual EXPR GenerateConversion(EXPR arg, CType CType, bool bChecked)
 {
     return GenerateConversionWithSource(Visit(arg), CType, bChecked || arg.isChecked());
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:4,代码来源:ExpressionTreeRewriter.cs


示例20: GenerateQuestionMarkOperand

 protected virtual EXPR GenerateQuestionMarkOperand(EXPR pExpr)
 {
     Debug.Assert(pExpr != null);
     // We must not optimize away compiler-generated reference casts because
     // the expression tree API insists that the CType of both sides be identical.
     if (pExpr.isCAST())
     {
         return GenerateConversion(pExpr.asCAST().GetArgument(), pExpr.type, pExpr.isChecked());
     }
     return Visit(pExpr);
 }
开发者ID:noahfalk,项目名称:corefx,代码行数:11,代码来源:ExpressionTreeRewriter.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Semantics.TypeArray类代码示例发布时间:2022-05-26
下一篇:
C# Semantics.CType类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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