Beispiel #1
0
            private Cci.IDefinition VisitDefInternal(Cci.IDefinition def)
            {
                var type = def as Cci.ITypeDefinition;

                if (type != null)
                {
                    var namespaceType = type.AsNamespaceTypeDefinition(_sourceContext);
                    if (namespaceType != null)
                    {
                        return(VisitNamespaceType(namespaceType));
                    }

                    var nestedType = type.AsNestedTypeDefinition(_sourceContext);
                    Debug.Assert(nestedType != null);

                    var otherContainer = (Cci.ITypeDefinition) this.VisitDef(nestedType.ContainingTypeDefinition);
                    if (otherContainer == null)
                    {
                        return(null);
                    }

                    return(VisitTypeMembers(otherContainer, nestedType, GetNestedTypes, (a, b) => StringOrdinalComparer.Equals(a.Name, b.Name)));
                }

                var member = def as Cci.ITypeDefinitionMember;

                if (member != null)
                {
                    var otherContainer = (Cci.ITypeDefinition) this.VisitDef(member.ContainingTypeDefinition);
                    if (otherContainer == null)
                    {
                        return(null);
                    }

                    var field = def as Cci.IFieldDefinition;
                    if (field != null)
                    {
                        return(VisitTypeMembers(otherContainer, field, GetFields, (a, b) => StringOrdinalComparer.Equals(a.Name, b.Name)));
                    }
                }

                // We are only expecting types and fields currently.
                throw ExceptionUtilities.UnexpectedValue(def);
            }
 public Cci.IDefinition VisitDef(Cci.IDefinition def)
 {
     return(_matches.GetOrAdd(def, this.VisitDefInternal));
 }
Beispiel #3
0
 internal bool DefinitionExists(Cci.IDefinition definition)
 {
     return(MapDefinition(definition) != null);
 }
Beispiel #4
0
 internal abstract Cci.IDefinition MapDefinition(Cci.IDefinition definition);
Beispiel #5
0
 public abstract Cci.IDefinition MapDefinition(Cci.IDefinition reference);
Beispiel #6
0
 public abstract Cci.IDefinition?MapDefinition(Cci.IDefinition definition);
Beispiel #7
0
 internal abstract bool DefinitionExists(Cci.IDefinition def);
Beispiel #8
0
 internal Cci.IDefinition?MapDefinition(Cci.IDefinition definition)
 {
     return(MapToPreviousSymbolMatcher.MapDefinition(definition) ??
            (MapToMetadataSymbolMatcher != MapToPreviousSymbolMatcher ? MapToMetadataSymbolMatcher.MapDefinition(definition) : null));
 }
Beispiel #9
0
 internal bool DefinitionExists(Cci.IDefinition definition)
 => MapDefinition(definition) is object;
 public Cci.IDefinition?VisitDef(Cci.IDefinition def)
 => _matches.GetOrAdd(def, VisitDefInternal);
Beispiel #11
0
 internal Cci.IDefinition MapDefinition(Cci.IDefinition definition)
 {
     return(mapToPrevious.MapDefinition(definition) ??
            (mapToMetadata != mapToPrevious ? mapToMetadata.MapDefinition(definition) : null));
 }
        internal override bool DefinitionExists(Cci.IDefinition def)
        {
            var previous = this.mapToPrevious.MapDefinition(def);

            return(previous != null);
        }