本文整理汇总了C#中Microsoft.CSharp.RuntimeBinder.Semantics.AggregateType类的典型用法代码示例。如果您正苦于以下问题:C# AggregateType类的具体用法?C# AggregateType怎么用?C# AggregateType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AggregateType类属于Microsoft.CSharp.RuntimeBinder.Semantics命名空间,在下文中一共展示了AggregateType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GroupToArgsBinder
public GroupToArgsBinder(ExpressionBinder exprBinder, BindingFlag bindFlags, EXPRMEMGRP grp, ArgInfos args, ArgInfos originalArgs, bool bHasNamedArguments, AggregateType atsDelegate)
{
Debug.Assert(grp != null);
Debug.Assert(exprBinder != null);
Debug.Assert(args != null);
_pExprBinder = exprBinder;
_fCandidatesUnsupported = false;
_fBindFlags = bindFlags;
_pGroup = grp;
_pArguments = args;
_pOriginalArguments = originalArgs;
_bHasNamedArguments = bHasNamedArguments;
_pDelegate = atsDelegate;
_pCurrentType = null;
_pCurrentSym = null;
_pCurrentTypeArgs = null;
_pCurrentParameters = null;
_pBestParameters = null;
_nArgBest = -1;
_nWrongCount = 0;
_bIterateToEndOfNsList = false;
_bBindingCollectionAddArgs = false;
_results = new GroupToArgsBinderResult();
_methList = new List<CandidateFunctionMember>();
_mpwiParamTypeConstraints = new MethPropWithInst();
_mpwiBogus = new MethPropWithInst();
_mpwiCantInferInstArg = new MethPropWithInst();
_mwtBadArity = new MethWithType();
_HiddenTypes = new List<CType>();
}
开发者ID:er0dr1guez,项目名称:corefx,代码行数:31,代码来源:GroupToArgsBinder.cs
示例2: CheckAccess2
public virtual ACCESSERROR CheckAccess2(Symbol symCheck, AggregateType atsCheck, Symbol symWhere, CType typeThru)
{
Debug.Assert(symCheck != null);
Debug.Assert(atsCheck == null || symCheck.parent == atsCheck.getAggregate());
Debug.Assert(typeThru == null ||
typeThru.IsAggregateType() ||
typeThru.IsTypeParameterType() ||
typeThru.IsArrayType() ||
typeThru.IsNullableType() ||
typeThru.IsErrorType());
#if DEBUG
switch (symCheck.getKind())
{
default:
break;
case SYMKIND.SK_MethodSymbol:
case SYMKIND.SK_PropertySymbol:
case SYMKIND.SK_FieldSymbol:
case SYMKIND.SK_EventSymbol:
Debug.Assert(atsCheck != null);
break;
}
#endif // DEBUG
ACCESSERROR error = CheckAccessCore(symCheck, atsCheck, symWhere, typeThru);
if (ACCESSERROR.ACCESSERROR_NOERROR != error)
{
return error;
}
// Check the accessibility of the return CType.
CType CType = symCheck.getType();
if (CType == null)
{
return ACCESSERROR.ACCESSERROR_NOERROR;
}
// For members of AGGSYMs, atsCheck should always be specified!
Debug.Assert(atsCheck != null);
if (atsCheck.getAggregate().IsSource())
{
// We already check the "at least as accessible as" rules.
// Does this always work for generics?
// Could we get a bad CType argument in typeThru?
// Maybe call CheckTypeAccess on typeThru?
return ACCESSERROR.ACCESSERROR_NOERROR;
}
// Substitute on the CType.
if (atsCheck.GetTypeArgsAll().size > 0)
{
CType = SymbolLoader.GetTypeManager().SubstType(CType, atsCheck);
}
return CheckTypeAccess(CType, symWhere) ? ACCESSERROR.ACCESSERROR_NOERROR : ACCESSERROR.ACCESSERROR_NOACCESS;
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:60,代码来源:SemanticChecker.cs
示例3: AddInconvertibleResult
/////////////////////////////////////////////////////////////////////////////////
public void AddInconvertibleResult(
MethodSymbol method,
AggregateType currentType,
TypeArray currentTypeArgs)
{
if (InconvertibleResult.Sym == null)
{
// This is the first one, so set it for error reporting usage.
InconvertibleResult.Set(method, currentType, currentTypeArgs);
}
_inconvertibleResults.Add(new MethPropWithInst(method, currentType, currentTypeArgs));
}
开发者ID:noahfalk,项目名称:corefx,代码行数:14,代码来源:GroupToArgsBinderResult.cs
示例4: CreateAggregateType
// Aggregate
public AggregateType CreateAggregateType(
Name name,
AggregateSymbol parent,
TypeArray typeArgsThis,
AggregateType outerType)
{
AggregateType type = new AggregateType();
type.outerType = outerType;
type.SetOwningAggregate(parent);
type.SetTypeArgsThis(typeArgsThis);
type.SetName(name);
type.SetTypeKind(TypeKind.TK_AggregateType);
return type;
}
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:17,代码来源:TypeFactory.cs
示例5: GetAts
public AggregateType GetAts(ErrorHandling errorContext)
{
AggregateSymbol aggNullable = typeManager.GetNullable();
if (aggNullable == null)
{
throw Error.InternalCompilerError();
}
if (ats == null)
{
CType typePar = GetUnderlyingType();
CType[] typeParArray = new CType[] { typePar };
TypeArray ta = symmgr.AllocParams(1, typeParArray);
ats = typeManager.GetAggregate(aggNullable, ta);
}
return ats;
}
开发者ID:dotnet,项目名称:corefx,代码行数:17,代码来源:NullableType.cs
示例6: GetBaseClass
public AggregateType GetBaseClass()
{
#if CSEE
AggregateType atsBase = getAggregate().GetBaseClass();
if (!atsBase || GetTypeArgsAll().size == 0 || atsBase.GetTypeArgsAll().size == 0)
return atsBase;
return getAggregate().GetTypeManager().SubstType(atsBase, GetTypeArgsAll()).AsAggregateType();
#else // !CSEE
if (_baseType == null)
{
_baseType = getAggregate().GetTypeManager().SubstType(getAggregate().GetBaseClass(), GetTypeArgsAll()) as AggregateType;
}
return _baseType;
#endif // !CSEE
}
开发者ID:er0dr1guez,项目名称:corefx,代码行数:18,代码来源:AggregateType.cs
示例7: GetAts
public AggregateType GetAts(ErrorHandling errorContext)
{
AggregateSymbol aggNullable = typeManager.GetNullable();
if (aggNullable == null)
{
throw Error.InternalCompilerError();
}
if (ats == null)
{
if (aggNullable == null)
{
typeManager.ReportMissingPredefTypeError(errorContext, PredefinedType.PT_G_OPTIONAL);
return null;
}
CType typePar = GetUnderlyingType();
CType[] typeParArray = new CType[] { typePar };
TypeArray ta = symmgr.AllocParams(1, typeParArray);
ats = typeManager.GetAggregate(aggNullable, ta);
}
return ats;
}
开发者ID:Rayislandstyle,项目名称:corefx,代码行数:23,代码来源:NullableType.cs
示例8: FieldWithType
public FieldWithType(FieldSymbol field, AggregateType ats)
{
Set(field, ats);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:4,代码来源:WithType.cs
示例9: MethPropWithInst
public MethPropWithInst(MethodOrPropertySymbol mps, AggregateType ats)
: this(mps, ats, null)
{
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:4,代码来源:WithType.cs
示例10: PropWithType
public PropWithType(PropertySymbol prop, AggregateType ats)
{
Set(prop, ats);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:4,代码来源:WithType.cs
示例11: EventWithType
public EventWithType(EventSymbol @event, AggregateType ats)
{
Set(@event, ats);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:4,代码来源:WithType.cs
示例12: MethPropWithType
public MethPropWithType(MethodOrPropertySymbol mps, AggregateType ats)
{
Set(mps, ats);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:4,代码来源:WithType.cs
示例13: MethWithType
public MethWithType(MethodSymbol meth, AggregateType ats)
{
Set(meth, ats);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:4,代码来源:WithType.cs
示例14: MethWithInst
public MethWithInst(MethodSymbol meth, AggregateType ats)
: this(meth, ats, null)
{
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:4,代码来源:WithType.cs
示例15: LowerBoundInterfaceInference
////////////////////////////////////////////////////////////////////////////////
private bool LowerBoundInterfaceInference(CType pSource, AggregateType pDest)
{
if (!pDest.isInterfaceType())
{
return false;
}
// SPEC: Otherwise, if V is an interface CType C<V1...Vk> and U is a class CType
// SPEC: or struct CType and there is a unique set U1...Uk such that U directly
// SPEC: or indirectly implements C<U1...Uk> then an
// SPEC: exact, upper-bound, or lower-bound inference ...
// SPEC: ... and U is an interface CType ...
// SPEC: ... and U is a CType parameter ...
//TypeArray pInterfaces = null;
if (!pSource.isStructType() && !pSource.isClassType() &&
!pSource.isInterfaceType() && !pSource.IsTypeParameterType())
{
return false;
}
var interfaces = pSource.AllPossibleInterfaces();
AggregateType pInterface = null;
foreach (AggregateType pCurrent in interfaces)
{
if (pCurrent.GetOwningAggregate() == pDest.GetOwningAggregate())
{
if (pInterface == null)
{
pInterface = pCurrent;
}
else if (pInterface != pCurrent)
{
// Not unique. Bail out.
return false;
}
}
}
if (pInterface == null)
{
return false;
}
LowerBoundTypeArgumentInference(pInterface, pDest);
return true;
}
开发者ID:noahfalk,项目名称:corefx,代码行数:48,代码来源:MethodTypeInferrer.cs
示例16: SymWithType
public SymWithType(Symbol sym, AggregateType ats)
{
Set(sym, ats);
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:4,代码来源:WithType.cs
示例17: CheckAccessCore
//
// SymbolLoader forwarders (end)
/////////////////////////////////////////////////////////////////////////////////
//
// Utility methods
//
protected ACCESSERROR CheckAccessCore(Symbol symCheck, AggregateType atsCheck, Symbol symWhere, CType typeThru)
{
Debug.Assert(symCheck != null);
Debug.Assert(atsCheck == null || symCheck.parent == atsCheck.getAggregate());
Debug.Assert(typeThru == null ||
typeThru.IsAggregateType() ||
typeThru.IsTypeParameterType() ||
typeThru.IsArrayType() ||
typeThru.IsNullableType() ||
typeThru.IsErrorType());
switch (symCheck.GetAccess())
{
default:
throw Error.InternalCompilerError();
//return ACCESSERROR.ACCESSERROR_NOACCESS;
case ACCESS.ACC_UNKNOWN:
return ACCESSERROR.ACCESSERROR_NOACCESS;
case ACCESS.ACC_PUBLIC:
return ACCESSERROR.ACCESSERROR_NOERROR;
case ACCESS.ACC_PRIVATE:
case ACCESS.ACC_PROTECTED:
if (symWhere == null)
{
return ACCESSERROR.ACCESSERROR_NOACCESS;
}
break;
case ACCESS.ACC_INTERNAL:
case ACCESS.ACC_INTERNALPROTECTED: // Check internal, then protected.
if (symWhere == null)
{
return ACCESSERROR.ACCESSERROR_NOACCESS;
}
if (symWhere.SameAssemOrFriend(symCheck))
{
return ACCESSERROR.ACCESSERROR_NOERROR;
}
if (symCheck.GetAccess() == ACCESS.ACC_INTERNAL)
{
return ACCESSERROR.ACCESSERROR_NOACCESS;
}
break;
}
// Should always have atsCheck for private and protected access check.
// We currently don't need it since access doesn't respect instantiation.
// We just use symWhere.parent.AsAggregateSymbol() instead.
AggregateSymbol aggCheck = symCheck.parent.AsAggregateSymbol();
// Find the inner-most enclosing AggregateSymbol.
AggregateSymbol aggWhere = null;
for (Symbol symT = symWhere; symT != null; symT = symT.parent)
{
if (symT.IsAggregateSymbol())
{
aggWhere = symT.AsAggregateSymbol();
break;
}
if (symT.IsAggregateDeclaration())
{
aggWhere = symT.AsAggregateDeclaration().Agg();
break;
}
}
if (aggWhere == null)
{
return ACCESSERROR.ACCESSERROR_NOACCESS;
}
// First check for private access.
for (AggregateSymbol agg = aggWhere; agg != null; agg = agg.GetOuterAgg())
{
if (agg == aggCheck)
{
return ACCESSERROR.ACCESSERROR_NOERROR;
}
}
if (symCheck.GetAccess() == ACCESS.ACC_PRIVATE)
{
return ACCESSERROR.ACCESSERROR_NOACCESS;
}
// Handle the protected case - which is the only real complicated one.
Debug.Assert(symCheck.GetAccess() == ACCESS.ACC_PROTECTED || symCheck.GetAccess() == ACCESS.ACC_INTERNALPROTECTED);
//.........这里部分代码省略.........
开发者ID:ChuangYang,项目名称:corefx,代码行数:101,代码来源:SemanticChecker.cs
示例18: GetFixedDelegateParameters
////////////////////////////////////////////////////////////////////////////////
private TypeArray GetFixedDelegateParameters(AggregateType pDelegateType)
{
Debug.Assert(pDelegateType.isDelegateType());
// We have a delegate where the input types use no unfixed parameters. Create
// a substitution context; we can substitute unfixed parameters for themselves
// since they don't actually occur in the inputs. (They may occur in the outputs,
// or there may be input parameters fixed to _unfixed_ method CType variables.
// Both of those scenarios are legal.)
CType[] ppMethodParameters = new CType[_pMethodTypeParameters.size];
for (int iParam = 0; iParam < _pMethodTypeParameters.size; iParam++)
{
TypeParameterType pParam = _pMethodTypeParameters.ItemAsTypeParameterType(iParam);
ppMethodParameters[iParam] = IsUnfixed(iParam) ? pParam : _pFixedResults[iParam];
}
SubstContext subsctx = new SubstContext(_pClassTypeArguments.ToArray(), _pClassTypeArguments.size,
ppMethodParameters, _pMethodTypeParameters.size);
AggregateType pFixedDelegateType =
GetTypeManager().SubstType(pDelegateType, subsctx).AsAggregateType();
TypeArray pFixedDelegateParams =
pFixedDelegateType.GetDelegateParameters(GetSymbolLoader());
return pFixedDelegateParams;
}
开发者ID:noahfalk,项目名称:corefx,代码行数:26,代码来源:MethodTypeInferrer.cs
示例19: UpperBoundTypeArgumentInference
////////////////////////////////////////////////////////////////////////////////
private void UpperBoundTypeArgumentInference(
AggregateType pSource, AggregateType pDest)
{
// SPEC: The choice of inference for the i-th CType argument is made
// SPEC: based on the declaration of the i-th CType parameter of C, as
// SPEC: follows:
// SPEC: if Ui is known to be of reference CType and the i-th CType parameter
// SPEC: was declared as covariant then an upper-bound inference is made.
// SPEC: if Ui is known to be of reference CType and the i-th CType parameter
// SPEC: was declared as contravariant then a lower-bound inference is made.
// SPEC: otherwise, an exact inference is made.
Debug.Assert(pSource != null);
Debug.Assert(pDest != null);
Debug.Assert(pSource.GetOwningAggregate() == pDest.GetOwningAggregate());
TypeArray pTypeParams = pSource.GetOwningAggregate().GetTypeVarsAll();
TypeArray pSourceArgs = pSource.GetTypeArgsAll();
TypeArray pDestArgs = pDest.GetTypeArgsAll();
Debug.Assert(pTypeParams != null);
Debug.Assert(pSourceArgs != null);
Debug.Assert(pDestArgs != null);
Debug.Assert(pTypeParams.size == pSourceArgs.size);
Debug.Assert(pTypeParams.size == pDestArgs.size);
for (int arg = 0; arg < pSourceArgs.size; ++arg)
{
TypeParameterType pTypeParam = pTypeParams.ItemAsTypeParameterType(arg);
CType pSourceArg = pSourceArgs.Item(arg);
CType pDestArg = pDestArgs.Item(arg);
if (pSourceArg.IsRefType() && pTypeParam.Covariant)
{
UpperBoundInference(pSourceArg, pDestArg);
}
else if (pSourceArg.IsRefType() && pTypeParam.Contravariant)
{
LowerBoundInference(pSourceArgs.Item(arg), pDestArgs.Item(arg));
}
else
{
ExactInference(pSourceArgs.Item(arg), pDestArgs.Item(arg));
}
}
}
开发者ID:noahfalk,项目名称:corefx,代码行数:49,代码来源:MethodTypeInferrer.cs
示例20: UpperBoundInterfaceInference
////////////////////////////////////////////////////////////////////////////////
private bool UpperBoundInterfaceInference(AggregateType pSource, CType pDest)
{
if (!pSource.isInterfaceType())
{
return false;
}
// SPEC: Otherwise, if U is an interface CType C<U1...Uk> and V is a class CType
// SPEC: or struct CType and there is a unique set V1...Vk such that V directly
// SPEC: or indirectly implements C<V1...Vk> then an exact ...
// SPEC: ... and U is an interface CType ...
if (!pDest.isStructType() && !pDest.isClassType() &&
!pDest.isInterfaceType())
{
return false;
}
var interfaces = pDest.AllPossibleInterfaces();
AggregateType pInterface = null;
foreach (AggregateType pCurrent in interfaces)
{
if (pCurrent.GetOwningAggregate() == pSource.GetOwningAggregate())
{
if (pInterface == null)
{
pInterface = pCurrent;
}
else if (pInterface != pCurrent)
{
// Not unique. Bail out.
return false;
}
}
}
if (pInterface == null)
{
return false;
}
UpperBoundTypeArgumentInference(pInterface, pDest.AsAggregateType());
return true;
}
开发者ID:noahfalk,项目名称:corefx,代码行数:44,代码来源:MethodTypeInferrer.cs
注:本文中的Microsoft.CSharp.RuntimeBinder.Semantics.AggregateType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论