当前位置: 首页>>代码示例>>C#>>正文


C# ReferenceExpression.IsTargetOfAssignment方法代码示例

本文整理汇总了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));
		}
开发者ID:0xb1dd1e,项目名称:boo,代码行数:20,代码来源:CheckMembersProtectionLevel.cs

示例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;
        }
开发者ID:stuman08,项目名称:boo,代码行数:19,代码来源:ProcessMethodBodies.cs

示例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;
 }
开发者ID:stuman08,项目名称:boo,代码行数:11,代码来源:ProcessMethodBodies.cs

示例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;
                    }
            }
        }
开发者ID:stuman08,项目名称:boo,代码行数:79,代码来源:ProcessMethodBodies.cs


注:本文中的Boo.Lang.Compiler.Ast.ReferenceExpression.IsTargetOfAssignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。