本文整理汇总了C#中ExpressionKind类的典型用法代码示例。如果您正苦于以下问题:C# ExpressionKind类的具体用法?C# ExpressionKind怎么用?C# ExpressionKind使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpressionKind类属于命名空间,在下文中一共展示了ExpressionKind类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: bindUserDefinedBinOp
protected EXPR bindUserDefinedBinOp(ExpressionKind ek, BinOpArgInfo info)
{
MethPropWithInst pmpwi = null;
if (info.pt1 <= PredefinedType.PT_ULONG && info.pt2 <= PredefinedType.PT_ULONG)
{
return null;
}
EXPR expr = null;
switch (info.binopKind)
{
case BinOpKind.Logical:
{
// Logical operators cannot be overloaded, but use the bitwise overloads.
EXPRCALL call = BindUDBinop((ExpressionKind)(ek - ExpressionKind.EK_LOGAND + ExpressionKind.EK_BITAND), info.arg1, info.arg2, true, out pmpwi);
if (call != null)
{
if (call.isOK())
{
expr = BindUserBoolOp(ek, call);
}
else
{
expr = call;
}
}
break;
}
default:
expr = BindUDBinop(ek, info.arg1, info.arg2, false, out pmpwi);
break;
}
if (expr == null)
{
return null;
}
return GetExprFactory().CreateUserDefinedBinop(ek, expr.type, info.arg1, info.arg2, expr, pmpwi);
}
开发者ID:ESgarbi,项目名称:corefx,代码行数:41,代码来源:Operators.cs
示例17: MemberAccessExpressionNode
public MemberAccessExpressionNode() : super(ExpressionKind.MemberAccess) {}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:1,代码来源:MemberAccessExpressionNode.stab.cs
示例18: super
: super(ExpressionKind.ArrayInitializer) {
this.Values = new ArrayList<ExpressionNode>();
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:3,代码来源:ArrayCreationExpressionNode.stab.cs
示例19: super
: super(ExpressionKind.Assign) {
}
开发者ID:nagyistoce,项目名称:cnatural-language,代码行数:2,代码来源:AssignExpressionNode.stab.cs
示例20: 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
注:本文中的ExpressionKind类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论