예제 #1
0
        internal string AddSpecReference(
            ISymbol symbol,
            IReadOnlyList <string> typeGenericParameters,
            IReadOnlyList <string> methodGenericParameters,
            Dictionary <string, ReferenceItem> references,
            SymbolVisitorAdapter adapter)
        {
            var           id        = SpecIdHelper.GetSpecId(symbol, typeGenericParameters, methodGenericParameters);
            ReferenceItem reference = new ReferenceItem();

            reference.Parts = new SortedList <SyntaxLanguage, List <LinkItem> >();
            GenerateReferenceInternal(symbol, reference, adapter);
            reference.IsDefinition = symbol.IsDefinition;

            if (!symbol.IsDefinition)
            {
                var def            = symbol.OriginalDefinition;
                var typeParameters = def.Accept(TypeGenericParameterNameVisitor.Instance);
                reference.Definition = AddSpecReference(def, typeParameters, null, references, adapter);
            }

            reference.Parent = GetReferenceParent(symbol, typeGenericParameters, methodGenericParameters, references, adapter);

            if (!references.ContainsKey(id))
            {
                references[id] = reference;
            }
            else
            {
                references[id].Merge(reference);
            }

            return(id);
        }
예제 #2
0
 private void AddInheritedMembers(INamedTypeSymbol symbol, INamedTypeSymbol type, Dictionary <string, string> dict, IReadOnlyList <string> typeParamterNames)
 {
     foreach (var m in from m in type.GetMembers()
              where !(m is INamedTypeSymbol)
              where VisitorHelper.CanVisit(m, symbol == type || !symbol.IsSealed || symbol.TypeKind != TypeKind.Struct)
              where IsInheritable(m)
              select m)
     {
         var sig = MemberSigRegex.Replace(SpecIdHelper.GetSpecId(m, typeParamterNames), string.Empty);
         if (!dict.ContainsKey(sig))
         {
             dict.Add(sig, type == symbol ? null : AddSpecReference(m, typeParamterNames));
         }
     }
 }