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


C# TypeSystem.Ambiguous类代码示例

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

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

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

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

示例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;
 }
开发者ID:w4x,项目名称:boolangstudio,代码行数:17,代码来源:NameResolutionService.cs

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

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

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

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

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

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

示例12: ResolveAmbiguousExtension

        private IEntity ResolveAmbiguousExtension(MethodInvocationExpression node, Ambiguous ambiguous)
        {
            IEntity resolved = ResolveCallableReference(node, ambiguous);
            if (null != resolved) return resolved;

            return CantResolveAmbiguousMethodInvocation(node, ambiguous.Entities);
        }
开发者ID:w4x,项目名称:boolangstudio,代码行数:7,代码来源:ProcessMethodBodies.cs

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

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

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


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