예제 #1
0
파일: ClassInfo.cs 프로젝트: tk811/PTVS
 internal ClassInfo(ClassDefinition klass, AnalysisUnit outerUnit)
 {
     _instanceInfo = new InstanceInfo(this);
     _bases        = new List <IAnalysisSet>();
     _declVersion  = outerUnit.ProjectEntry.AnalysisVersion;
     _projectState = outerUnit.ProjectState;
     _mro          = new Mro(this);
 }
예제 #2
0
        internal override bool UnionEquals(AnalysisValue ns, int strength)
        {
            if (strength >= MergeStrength.ToObject)
            {
                var type = _projectState.ClassInfos[BuiltinTypeId.Type];
                return(ns is ClassInfo || ns is BuiltinClassInfo || ns == type || ns == type.Instance);
            }
            else if (strength >= MergeStrength.ToBaseClass)
            {
                var ci = ns as ClassInfo;
                if (ci != null)
                {
                    IEnumerable <AnalysisValue> mro1;
                    AnalysisValue[]             mro2;
                    if (IsFirstForMroUnion(ClassDefinition, ci.ClassDefinition))
                    {
                        mro1 = Mro.SelectMany().Except(_projectState.DoNotUnionInMro.AsEnumerable());
                        mro2 = ci.Mro.SelectMany().Except(_projectState.DoNotUnionInMro.AsEnumerable()).ToArray();
                    }
                    else
                    {
                        mro1 = ci.Mro.SelectMany().Except(_projectState.DoNotUnionInMro.AsEnumerable());
                        mro2 = Mro.SelectMany().Except(_projectState.DoNotUnionInMro.AsEnumerable()).ToArray();
                    }
                    return(mro1.Any(cls => mro2.Contains(cls)));
                }

                var bci = ns as BuiltinClassInfo;
                if (bci != null &&
                    !_projectState.DoNotUnionInMro.Contains(this) &&
                    !_projectState.DoNotUnionInMro.Contains(bci))
                {
                    return(Mro.Any(m => m.Contains(bci)));
                }
            }

            return(base.UnionEquals(ns, strength));
        }