本文整理汇总了C#中Boo.Lang.Compiler.TypeSystem.Ambiguous类的典型用法代码示例。如果您正苦于以下问题:C# Ambiguous类的具体用法?C# Ambiguous怎么用?C# Ambiguous使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ambiguous类属于Boo.Lang.Compiler.TypeSystem命名空间,在下文中一共展示了Ambiguous类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResolveAmbiguousMethodReference
private IEntity ResolveAmbiguousMethodReference(ReferenceExpression node, Ambiguous candidates, ExpressionCollection args)
{
//BOO-656
if (!AstUtil.IsTargetOfMethodInvocation(node)
&& !AstUtil.IsTargetOfSlicing(node)
&& !node.IsTargetOfAssignment())
{
return candidates.Entities[0];
}
return candidates;
}
示例2: ResolveAmbiguousPropertyReference
private IEntity ResolveAmbiguousPropertyReference(ReferenceExpression node, Ambiguous candidates, ExpressionCollection args)
{
IEntity[] entities = candidates.Entities;
IEntity[] getters = GetGetMethods(entities);
IEntity found = GetCorrectCallableReference(node, args, getters);
if (null != found && EntityType.Method == found.EntityType)
{
IProperty property = (IProperty)entities[GetIndex(getters, found)];
BindProperty(node, property);
return property;
}
return candidates;
}
示例3: GetMatchesByGenericity
private List<IEntity> GetMatchesByGenericity(ReferenceExpression node, Ambiguous candidates)
{
bool isGenericReference = (node.ParentNode is GenericReferenceExpression);
List<IEntity> matches = new List<IEntity>();
foreach (IEntity candidate in candidates.Entities)
{
IType type = candidate as IType;
bool isGenericType = (type != null && type.GenericInfo != null);
if (isGenericType == isGenericReference)
{
matches.Add(candidate);
}
}
return matches;
}
示例4: ResolveAmbiguousLValue
private IEntity ResolveAmbiguousLValue(Expression sourceNode, Ambiguous candidates, Expression rvalue)
{
if (!candidates.AllEntitiesAre(EntityType.Property)) return null;
IEntity[] entities = candidates.Entities;
IEntity[] getters = GetSetMethods(entities);
ExpressionCollection args = new ExpressionCollection();
args.Add(rvalue);
IEntity found = GetCorrectCallableReference(sourceNode, args, getters);
if (null != found && EntityType.Method == found.EntityType)
{
IProperty property = (IProperty)entities[GetIndex(getters, found)];
BindProperty(sourceNode, property);
return property;
}
return null;
}
示例5: GetEntityFromList
public static IEntity GetEntityFromList(IList list)
{
IEntity element = null;
if (list.Count > 0)
{
if (list.Count > 1)
{
element = new Ambiguous(list);
}
else
{
element = (IEntity)list[0];
}
list.Clear();
}
return element;
}
示例6: ResolveCallableReference
private IEntity ResolveCallableReference(MethodInvocationExpression node, Ambiguous entity)
{
IEntity resolved = CallableResolutionService.ResolveCallableReference(node.Arguments, entity.Entities);
if (null == resolved)
return null;
IMember member = (IMember)resolved;
if (NodeType.ReferenceExpression == node.Target.NodeType)
{
ResolveMemberInfo((ReferenceExpression)node.Target, member);
}
else
{
Bind(node.Target, member);
BindExpressionType(node.Target, member.Type);
}
return resolved;
}
示例7: MapAmbiguousEntity
private IEntity MapAmbiguousEntity(Ambiguous source)
{
// Map each individual entity in the ambiguous list
return new Ambiguous(Array.ConvertAll<IEntity, IEntity>(source.Entities, Map));
}
示例8: ResolveAmbiguousTypeReference
private IEntity ResolveAmbiguousTypeReference(ReferenceExpression node, Ambiguous candidates)
{
List<IEntity> matches = GetMatchesByGenericity(node, candidates);
if (matches.Count > 1)
{
PreferInternalEntitiesOverNonInternal(matches);
}
if (matches.Count == 1)
{
Bind(node, matches[0]);
}
else
{
Bind(node, new Ambiguous(matches));
}
return node.Entity;
}
示例9: ResolveAmbiguousReferenceByAccessibility
private IEntity ResolveAmbiguousReferenceByAccessibility(Ambiguous candidates)
{
List newEntities = new List();
foreach (IEntity entity in candidates.Entities)
{
if (!IsInaccessible(entity))
{ newEntities.Add(entity); }
}
if (newEntities.Count == 1)
{ return (IEntity)newEntities[0]; }
return new Ambiguous(newEntities);
}
示例10: ResolveAmbiguousTypeReference
private IEntity ResolveAmbiguousTypeReference(ReferenceExpression node, Ambiguous candidates)
{
bool isGenericReference = (node.ParentNode is GenericReferenceExpression);
List matches = new List();
foreach (IEntity candidate in candidates.Entities)
{
IType type = candidate as IType;
bool isGenericType = (type != null && type.GenericInfo != null);
if (isGenericType == isGenericReference)
{
matches.Add(candidate);
}
}
if (matches.Count == 1)
{
Bind(node, (IEntity)matches[0]);
}
else
{
Bind(node, new Ambiguous(matches));
}
return node.Entity;
}
示例11: ResolveAmbiguousReference
private IEntity ResolveAmbiguousReference(ReferenceExpression node, Ambiguous candidates)
{
if (!AstUtil.IsTargetOfSlicing(node)
&& !AstUtil.IsLhsOfAssignment(node))
{
if (candidates.AllEntitiesAre(EntityType.Property))
{
return ResolveAmbiguousPropertyReference(node, candidates, EmptyExpressionCollection);
}
else if (candidates.AllEntitiesAre(EntityType.Method))
{
return ResolveAmbiguousMethodReference(node, candidates, EmptyExpressionCollection);
}
else if (candidates.AllEntitiesAre(EntityType.Type))
{
return ResolveAmbiguousTypeReference(node, candidates);
}
}
return ResolveAmbiguousReferenceByAccessibility(candidates);
}
示例12: ResolveAmbiguousExtension
private IEntity ResolveAmbiguousExtension(MethodInvocationExpression node, Ambiguous ambiguous)
{
IEntity resolved = ResolveCallableReference(node, ambiguous);
if (null != resolved) return resolved;
return CantResolveAmbiguousMethodInvocation(node, ambiguous.Entities);
}
示例13: ResolveAmbiguousMethodInvocation
protected virtual IEntity ResolveAmbiguousMethodInvocation(MethodInvocationExpression node, Ambiguous entity)
{
_context.TraceVerbose("{0}: resolving ambigous method invocation: {1}", node.LexicalInfo, entity);
IEntity resolved = ResolveCallableReference(node, entity);
if (null != resolved) return resolved;
if (TryToProcessAsExtensionInvocation(node)) return null;
return CantResolveAmbiguousMethodInvocation(node, entity.Entities);
}
示例14: ResolveAmbiguousReference
private IEntity ResolveAmbiguousReference(ReferenceExpression node, Ambiguous candidates)
{
var resolved = ResolveAmbiguousReferenceByAccessibility(candidates);
var accessibleCandidates = resolved as Ambiguous;
if (accessibleCandidates == null || AstUtil.IsTargetOfSlicing(node) || node.IsTargetOfAssignment())
return resolved;
if (accessibleCandidates.AllEntitiesAre(EntityType.Property))
return ResolveAmbiguousPropertyReference(node, accessibleCandidates, EmptyExpressionCollection);
if (accessibleCandidates.AllEntitiesAre(EntityType.Method))
return ResolveAmbiguousMethodReference(node, accessibleCandidates, EmptyExpressionCollection);
if (accessibleCandidates.AllEntitiesAre(EntityType.Type))
return ResolveAmbiguousTypeReference(node, accessibleCandidates);
return resolved;
}
示例15: ResolveMacroExtensionType
IEntity ResolveMacroExtensionType(MacroStatement node, Ambiguous extensions)
{
if (null == extensions)
return null;
foreach (var entity in extensions.Entities)
{
var extensionType = ResolveMacroExtensionType(node, entity as IMethod);
if (null != extensionType)
return extensionType;
}
return null;
}