本文整理汇总了C#中Boo.Lang.Compiler.Ast.ReferenceExpression.IsTargetOfAssignment方法的典型用法代码示例。如果您正苦于以下问题:C# ReferenceExpression.IsTargetOfAssignment方法的具体用法?C# ReferenceExpression.IsTargetOfAssignment怎么用?C# ReferenceExpression.IsTargetOfAssignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Boo.Lang.Compiler.Ast.ReferenceExpression
的用法示例。
在下文中一共展示了ReferenceExpression.IsTargetOfAssignment方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnReferenceExpression
override public void OnReferenceExpression(ReferenceExpression node)
{
var member = node.Entity as IAccessibleMember;
if (null == member) return;
if (!IsAccessible(member))
{
Error(CompilerErrorFactory.UnaccessibleMember(node, member));
return;
}
//if member is a property we also want to check the accessor specifically
var property = member as IProperty;
if (null == property)
return;
member = node.IsTargetOfAssignment() ? property.GetSetMethod() : property.GetGetMethod();
if (!IsAccessible(member))
Error(CompilerErrorFactory.UnaccessibleMember(node, member));
}
示例2: 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;
}
示例3: 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;
}
示例4: PostProcessReferenceExpression
void PostProcessReferenceExpression(ReferenceExpression node)
{
var entity = GetEntity(node);
switch (entity.EntityType)
{
case EntityType.Type:
{
BindNonGenericTypeReferenceExpressionType(node, (IType)entity);
break;
}
case EntityType.Method:
{
var method = entity as IMethod;
if (null != method && IsGenericMethod(method) && IsStandaloneReference(node) && !IsSubjectToGenericArgumentInference(node))
CannotInferGenericMethodArguments(node, method);
break;
}
case EntityType.Ambiguous:
{
var ambiguous = (Ambiguous) entity;
var resolvedEntity = ResolveAmbiguousReference(node, ambiguous);
var resolvedMember = resolvedEntity as IMember;
if (null != resolvedMember)
{
ResolveMemberInfo(node, resolvedMember);
break;
}
if (resolvedEntity is IType)
{
BindNonGenericTypeReferenceExpressionType(node, (IType)resolvedEntity);
break;
}
if (!AstUtil.IsTargetOfMethodInvocation(node)
&& !AstUtil.IsTargetOfSlicing(node)
&& !node.IsTargetOfAssignment())
{
Error(node, CompilerErrorFactory.AmbiguousReference(
node,
node.Name,
ambiguous.Entities));
}
break;
}
case EntityType.Namespace:
{
if (IsStandaloneReference(node))
Error(node, CompilerErrorFactory.NamespaceIsNotAnExpression(node, entity.Name));
break;
}
case EntityType.Parameter:
case EntityType.Local:
{
var local = (ILocalEntity)node.Entity;
local.IsUsed = true;
BindExpressionType(node, local.Type);
break;
}
default:
{
if (EntityType.BuiltinFunction == entity.EntityType)
{
CheckBuiltinUsage(node, entity);
}
else
{
if (node.ExpressionType == null)
{
BindExpressionType(node, ((ITypedEntity)entity).Type);
}
}
break;
}
}
}