本文整理汇总了C#中IEntity.IsAmbiguous方法的典型用法代码示例。如果您正苦于以下问题:C# IEntity.IsAmbiguous方法的具体用法?C# IEntity.IsAmbiguous怎么用?C# IEntity.IsAmbiguous使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IEntity
的用法示例。
在下文中一共展示了IEntity.IsAmbiguous方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstructEntity
/// <summary>
/// Constructs an entity from a generic definition and arguments, after ensuring the construction is valid.
/// </summary>
/// <param name="definition">The generic definition entity.</param>
/// <param name="constructionNode">The node in which construction occurs.</param>
/// <param name="typeArguments">The generic type arguments to substitute for generic parameters.</param>
/// <returns>The constructed entity.</returns>
public IEntity ConstructEntity(Node constructionNode, IEntity definition, IType[] typeArguments)
{
// Ensure definition is a valid entity
if (definition == null || TypeSystemServices.IsError(definition))
{
return TypeSystemServices.ErrorEntity;
}
// Ambiguous generic constructions are handled separately
if (definition.IsAmbiguous())
{
return ConstructAmbiguousEntity(constructionNode, (Ambiguous)definition, typeArguments);
}
// Check that the construction is valid
if (!CheckGenericConstruction(constructionNode, definition, typeArguments, true))
{
return TypeSystemServices.ErrorEntity;
}
return MakeGenericEntity(definition, typeArguments);
}
示例2: SliceMember
void SliceMember(SlicingExpression node, IEntity member)
{
EnsureRelatedNodeWasVisited(node, member);
if (node.IsTargetOfAssignment())
{
// leave it to LeaveBinaryExpression to resolve
Bind(node, member);
return;
}
MethodInvocationExpression mie = new MethodInvocationExpression(node.LexicalInfo);
foreach (Slice index in node.Indices)
{
mie.Arguments.Add(index.Begin);
}
IMethod getter = null;
if (member.IsAmbiguous())
{
IEntity result = ResolveAmbiguousPropertyReference((ReferenceExpression)node.Target, (Ambiguous)member, mie.Arguments);
IProperty found = result as IProperty;
if (null != found)
{
getter = found.GetGetMethod();
}
else if (result.IsAmbiguous())
{
Error(node);
return;
}
}
else if (EntityType.Property == member.EntityType)
{
getter = ((IProperty)member).GetGetMethod();
}
if (null != getter)
{
if (AssertParameters(node, getter, mie.Arguments))
{
Expression target = GetIndexedPropertySlicingTarget(node);
mie.Target = CodeBuilder.CreateMemberReference(target, getter);
BindExpressionType(mie, getter.ReturnType);
node.ParentNode.Replace(node, mie);
}
else
{
Error(node);
}
}
else
{
NotImplemented(node, "slice for anything but arrays and default properties");
}
}
示例3: FindMethodOverridenBy
private static IMethod FindMethodOverridenBy(InternalMethod entity, IEntity candidates)
{
if (EntityType.Method == candidates.EntityType)
{
var candidate = (IMethod)candidates;
if (TypeSystemServices.CheckOverrideSignature(entity, candidate))
return candidate;
}
if (candidates.IsAmbiguous())
foreach (IMethod candidate in ((Ambiguous) candidates).Entities)
if (TypeSystemServices.CheckOverrideSignature(entity, candidate))
return candidate;
return null;
}
示例4: ResolveOperatorEntity
private IMethod ResolveOperatorEntity(IEntity op, ExpressionCollection args)
{
if (op.IsAmbiguous())
return ResolveAmbiguousOperator(((Ambiguous)op).Entities, args);
if (EntityType.Method == op.EntityType)
{
IMethod candidate = (IMethod)op;
if (HasOperatorSignature(candidate, args))
return candidate;
}
return null;
}
示例5: FindConflictingMember
private IMethod FindConflictingMember(IMethod extension, IEntity entity)
{
if (entity.IsAmbiguous())
return FindConflictingMember(extension, ((Ambiguous)entity).Entities);
var method = (IMethod)entity;
return IsConflictingMember(extension, method) ? method : null;
}