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; }
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); }