Example #1
0
        /// <summary>
        /// Returns the friendly qualified name of types, such as
        /// ``"System.Collection.Generic.List`1"`` or
        /// ``"System.Collection.Generic.List<System.Int32>"``.
        ///
        /// Note that method/type generic type parameters never show up in the returned name.
        /// </summary>
        public string GetQualifiedName()
        {
            using var writer = new EscapingTextWriter();
            WriteId(writer, false);
            var name = writer.ToString();

            return(name.Substring(name.IndexOf(AssemblyTypeNameSeparator) + 2).
                   Replace(";namespace", "").
                   Replace(";cil-type", ""));
        }
Example #2
0
        internal T Populate <T>(T e) where T : IExtractedEntity
        {
            if (e.Label.Valid)
            {
                return(e);   // Already populated
            }

            if (ids.TryGetValue(e, out var existing))
            {
                // It exists already
                e.Label = existing;
            }
            else
            {
                e.Label = GetNewLabel();
                DefineLabel(e);
                ids.Add(e, e.Label);
                PopulateLater(() =>
                {
                    foreach (var c in e.Contents)
                    {
                        c.Extract(this);
                    }
                });
#if DEBUG_LABELS
                using var writer = new EscapingTextWriter();
                e.WriteId(writer);
                var id = writer.ToString();

                if (debugLabels.TryGetValue(id, out var previousEntity))
                {
                    Extractor.Message(new Message("Duplicate trap ID", id, null, severity: Util.Logging.Severity.Warning));
                }
                else
                {
                    debugLabels.Add(id, e);
                }
#endif
            }
            return(e);
        }
Example #3
0
 public override string ToString()
 {
     using var w = new EscapingTextWriter();
     WriteId(w);
     return(w.ToString());
 }
Example #4
0
 public override string ToString()
 {
     using var writer = new EscapingTextWriter();
     WriteQuotedId(writer);
     return(writer.ToString());
 }