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


C# ExpressionKind类代码示例

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


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

示例1: ReferenceKindByParentReferenceKindTest

        public ExpressionKind ReferenceKindByParentReferenceKindTest(ExpressionKind kind)
        {
            // Arrange
            var helper = new ExpressionKindHelper();

            // Assert
            return helper.ReferenceKindByParentReferenceKind(kind);
        }
开发者ID:KozhevnikovDmitry,项目名称:MockMetrics,代码行数:8,代码来源:ExpressionKindHelperTests.cs

示例2: EatOptionValue

 private void EatOptionValue(ISnapshot snapshot, ExpressionKind kind, ICSharpExpression optionValue)
 {
     var addableKinds = new[] { ExpressionKind.Target, ExpressionKind.Stub, ExpressionKind.Mock };
     if (addableKinds.Contains(kind))
     {
         snapshot.Add(kind, optionValue);
     }
 }
开发者ID:KozhevnikovDmitry,项目名称:MockMetrics,代码行数:8,代码来源:MoqStubOptionsEater.cs

示例3: KindOfAssignmentTest

        public ExpressionKind KindOfAssignmentTest(ExpressionKind kind)
        {
            // Arrange
            var helper = new ExpressionKindHelper();

            // Assert
            return helper.KindOfAssignment(kind);
        }
开发者ID:KozhevnikovDmitry,项目名称:MockMetrics,代码行数:8,代码来源:ExpressionKindHelperTests.cs

示例4: InvocationKindByParentReferenceKind

        public virtual ExpressionKind InvocationKindByParentReferenceKind(ExpressionKind parentKind)
        {
            switch (parentKind)
            {
                case ExpressionKind.TargetCall:
                    {
                        return ExpressionKind.Result;
                    }
                case ExpressionKind.Target:
                    {
                        return ExpressionKind.TargetCall;
                    }
            }

            return parentKind;
        }
开发者ID:KozhevnikovDmitry,项目名称:MockMetrics,代码行数:16,代码来源:ExpressionKindHelper.cs

示例5: AddLocalVariableToSnapshotTest

        public void AddLocalVariableToSnapshotTest(ExpressionKind initKind, ExpressionKind variableKindMustBe)
        {
            // Arrange
            var snapshot = new Mock<ISnapshot>();
            var initializer = Mock.Of<IVariableInitializer>();
            var localConstantDeclaration = Mock.Of<ILocalVariableDeclaration>(t => t.Initial == initializer);
            var typeEater = Mock.Of<ITypeEater>();
            var eater = Mock.Of<IEater>();
            var initializerEater = Mock.Of<IVariableInitializerEater>(t => t.Eat(snapshot.Object, initializer) == initKind);
            var localConstantDeclarationEater = new LocalVariableDeclarationEater(eater, initializerEater, typeEater);

            // Act
            localConstantDeclarationEater.Eat(snapshot.Object, localConstantDeclaration);

            // Assert
            snapshot.Verify(t => t.Add(variableKindMustBe, localConstantDeclaration), Times.Once);
        }
开发者ID:KozhevnikovDmitry,项目名称:MockMetrics,代码行数:17,代码来源:LocalVariableDeclarationEaterTests.cs

示例6: ReferenceKindByParentReferenceKind

 public virtual ExpressionKind ReferenceKindByParentReferenceKind(ExpressionKind parentKind)
 {
     switch (parentKind)
     {
         case ExpressionKind.TargetCall:
             {
                 return ExpressionKind.Result;
             }
         case ExpressionKind.Target:
             {
                 return ExpressionKind.Result;
             }
         case ExpressionKind.Stub:
             {
                 return ExpressionKind.Stub;
             }
         case ExpressionKind.Mock:
             {
                 return ExpressionKind.Result;
             }
         case ExpressionKind.StubCandidate:
             {
                 return ExpressionKind.StubCandidate;
             }
         case ExpressionKind.Assert:
             {
                 return ExpressionKind.Result;
             }
         case ExpressionKind.None:
             {
                 return ExpressionKind.None;
             }
         case ExpressionKind.Result:
             {
                 return ExpressionKind.Result;
             }
         default:
             {
                 return ExpressionKind.None;
             }
     }
 }
开发者ID:KozhevnikovDmitry,项目名称:MockMetrics,代码行数:42,代码来源:ExpressionKindHelper.cs

示例7: KindOfAssignment

 public virtual ExpressionKind KindOfAssignment(ExpressionKind assignSourceKind)
 {
     switch (assignSourceKind)
     {
         case ExpressionKind.TargetCall:
             {
                 return ExpressionKind.Result;
             }
         case ExpressionKind.StubCandidate:
             {
                 return ExpressionKind.Stub;
             }
         case ExpressionKind.Assert:
             {
                 return ExpressionKind.Result;
             }
         default :
         {
             return assignSourceKind;
         }
     }
 }
开发者ID:KozhevnikovDmitry,项目名称:MockMetrics,代码行数:22,代码来源:ExpressionKindHelper.cs

示例8: ekName

 protected Name ekName(ExpressionKind ek)
 {
     Debug.Assert(ek >= ExpressionKind.EK_FIRSTOP && (ek - ExpressionKind.EK_FIRSTOP) < (int)s_EK2NAME.Length);
     return GetSymbolLoader().GetNameManager().GetPredefName(s_EK2NAME[ek - ExpressionKind.EK_FIRSTOP]);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:5,代码来源:ExpressionBinder.cs

示例9: BadOperatorTypesError

        protected EXPR BadOperatorTypesError(ExpressionKind ek, EXPR pOperand1, EXPR pOperand2, CType pTypeErr)
        {
            // This is a hack, but we need to store the operation somewhere... the first argument's as 
            // good a place as any.
            string strOp = pOperand1.errorString;

            pOperand1 = UnwrapExpression(pOperand1);

            if (pOperand1 != null)
            {
                if (pOperand2 != null)
                {
                    pOperand2 = UnwrapExpression(pOperand2);
                    if (pOperand1.type != null &&
                            !pOperand1.type.IsErrorType() &&
                            pOperand2.type != null &&
                            !pOperand2.type.IsErrorType())
                    {
                        ErrorContext.Error(ErrorCode.ERR_BadBinaryOps, strOp, pOperand1.type, pOperand2.type);
                    }
                }
                else if (pOperand1.type != null && !pOperand1.type.IsErrorType())
                {
                    ErrorContext.Error(ErrorCode.ERR_BadUnaryOp, strOp, pOperand1.type);
                }
            }

            if (pTypeErr == null)
            {
                pTypeErr = GetReqPDT(PredefinedType.PT_OBJECT);
            }

            EXPR rval = GetExprFactory().CreateOperator(ek, pTypeErr, pOperand1, pOperand2);
            rval.SetError();
            return rval;
        }
开发者ID:dotnet,项目名称:corefx,代码行数:36,代码来源:ExpressionBinder.cs

示例10: bindUDUnop

        internal EXPR bindUDUnop(ExpressionKind ek, EXPR arg)
        {
            Name pName = ekName(ek);
            Debug.Assert(pName != null);

            CType typeSrc = arg.type;

        LAgain:
            switch (typeSrc.GetTypeKind())
            {
                case TypeKind.TK_NullableType:
                    typeSrc = typeSrc.StripNubs();
                    goto LAgain;
                case TypeKind.TK_TypeParameterType:
                    typeSrc = typeSrc.AsTypeParameterType().GetEffectiveBaseClass();
                    goto LAgain;
                case TypeKind.TK_AggregateType:
                    if (!typeSrc.isClassType() && !typeSrc.isStructType() || typeSrc.AsAggregateType().getAggregate().IsSkipUDOps())
                        return null;
                    break;
                default:
                    return null;
            }

            ArgInfos info = new ArgInfos();

            info.carg = 1;
            FillInArgInfoFromArgList(info, arg);

            List<CandidateFunctionMember> methFirstList = new List<CandidateFunctionMember>();
            MethodSymbol methCur = null;
            AggregateType atsCur = typeSrc.AsAggregateType();

            for (; ;)
            {
                // Find the next operator.
                methCur = (methCur == null) ?
                          GetSymbolLoader().LookupAggMember(pName, atsCur.getAggregate(), symbmask_t.MASK_MethodSymbol).AsMethodSymbol() :
                          GetSymbolLoader().LookupNextSym(methCur, atsCur.getAggregate(), symbmask_t.MASK_MethodSymbol).AsMethodSymbol();

                if (methCur == null)
                {
                    // Find the next type.
                    // If we've found some applicable methods in a class then we don't need to look any further.
                    if (!methFirstList.IsEmpty())
                        break;
                    atsCur = atsCur.GetBaseClass();
                    if (atsCur == null)
                        break;
                    continue;
                }

                // Only look at operators with 1 args.
                if (!methCur.isOperator || methCur.Params.size != 1)
                    continue;
                Debug.Assert(methCur.typeVars.size == 0);

                TypeArray paramsCur = GetTypes().SubstTypeArray(methCur.Params, atsCur);
                CType typeParam = paramsCur.Item(0);
                NullableType nubParam;

                if (canConvert(arg, typeParam))
                {
                    methFirstList.Add(new CandidateFunctionMember(
                                    new MethPropWithInst(methCur, atsCur, BSYMMGR.EmptyTypeArray()),
                                    paramsCur,
                                    0,
                                    false));
                }
                else if (GetSymbolLoader().FCanLift() && typeParam.IsNonNubValType() &&
                         GetTypes().SubstType(methCur.RetType, atsCur).IsNonNubValType() &&
                         canConvert(arg, nubParam = GetTypes().GetNullable(typeParam)))
                {
                    methFirstList.Add(new CandidateFunctionMember(
                                    new MethPropWithInst(methCur, atsCur, BSYMMGR.EmptyTypeArray()),
                                    GetGlobalSymbols().AllocParams(1, new CType[] { nubParam }),
                                    1,
                                    false));
                }
            }

            if (methFirstList.IsEmpty())
                return null;

            CandidateFunctionMember pmethAmbig1;
            CandidateFunctionMember pmethAmbig2;
            CandidateFunctionMember pmethBest = FindBestMethod(methFirstList, null, info, out pmethAmbig1, out pmethAmbig2);

            if (pmethBest == null)
            {
                // No winner, so its an ambiguous call...
                ErrorContext.Error(ErrorCode.ERR_AmbigCall, pmethAmbig1.mpwi, pmethAmbig2.mpwi);

                EXPRMEMGRP pMemGroup = GetExprFactory().CreateMemGroup(null, pmethAmbig1.mpwi);
                EXPRCALL rval = GetExprFactory().CreateCall(0, null, arg, pMemGroup, null);
                rval.SetError();
                return rval;
            }

            if (SemanticChecker.CheckBogus(pmethBest.mpwi.Meth()))
//.........这里部分代码省略.........
开发者ID:dotnet,项目名称:corefx,代码行数:101,代码来源:ExpressionBinder.cs

示例11: BindStandardBinopCore

        protected EXPR BindStandardBinopCore(BinOpArgInfo info, BinOpFullSig bofs, ExpressionKind ek, EXPRFLAG flags)
        {
            if (bofs.pfn == null)
            {
                return BadOperatorTypesError(ek, info.arg1, info.arg2);
            }

            if (!bofs.isLifted() || !bofs.AutoLift())
            {
                EXPR expr1 = info.arg1;
                EXPR expr2 = info.arg2;
                if (bofs.ConvertOperandsBeforeBinding())
                {
                    expr1 = mustConvert(expr1, bofs.Type1());
                    expr2 = mustConvert(expr2, bofs.Type2());
                }
                if (bofs.fnkind == BinOpFuncKind.BoolBitwiseOp)
                {
                    return BindBoolBitwiseOp(ek, flags, expr1, expr2, bofs);
                }
                return bofs.pfn(ek, flags, expr1, expr2);
            }
            Debug.Assert(bofs.fnkind != BinOpFuncKind.BoolBitwiseOp);
            return BindLiftedStandardBinOp(info, bofs, ek, flags);
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:25,代码来源:Operators.cs

示例12: super

 : super(ExpressionKind.Field, field.getType()) {
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:1,代码来源:FieldExpression.stab.cs

示例13: super

			: super(ExpressionKind.ObjectCreation) {
			this.Arguments = new ArrayList<ExpressionNode>();
		}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:3,代码来源:ObjectCreationExpressionNode.stab.cs

示例14: super

			: super(ExpressionKind.Unary) {
		}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:2,代码来源:UnaryExpressionNode.stab.cs

示例15: super

 : super(ExpressionKind.MethodCall, method.getReturnType()) {
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:1,代码来源:MethodCallExpression.stab.cs


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