Skip to content
This repository was archived by the owner on Feb 28, 2022. It is now read-only.

Commit

Permalink
fix bug: package level members shouldn't be in inheritedmembers
Browse files Browse the repository at this point in the history
  • Loading branch information
ansyral committed May 31, 2017
1 parent 76d4262 commit a8790f5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ protected void FillInheritance(NameGeneratorContext context, ArticleItemYaml yam
protected void FillInheritedMembers(ArticleItemYaml yaml, XElement node)
{
var allMembers = from m in node.NullableElement("listofallmembers").Elements("member")
where m.NullableAttribute("prot").NullableValue() != "private"
where !YamlUtility.IsFiltered(m.NullableAttribute("prot").NullableValue())
select m.NullableAttribute("refid").NullableValue();
yaml.InheritedMembers = allMembers.Except(yaml.Children).ToList();
_references.AddRange(yaml.InheritedMembers.Select(i => new ReferenceViewModel { Uid = i }));
Expand Down
13 changes: 2 additions & 11 deletions src/Microsoft.Content.Build.Code2Yaml.Steps/ScanHierarchy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public Task RunAsync(BuildContext context)

// filter out package-private item
var prot = (string)def.Attribute("prot");
if (IsFiltered(prot))
if (YamlUtility.IsFiltered(prot))
{
itemsToRemove.Add(pair.Key);

Expand All @@ -78,7 +78,7 @@ public Task RunAsync(BuildContext context)
}

// check innerclass's access label because Doxygen would still output nested private/package-private classes
var innerClasses = def.Elements("innerclass").Where(e => !IsFiltered((string)e.Attribute("prot")));
var innerClasses = def.Elements("innerclass").Where(e => !YamlUtility.IsFiltered((string)e.Attribute("prot")));
foreach (var inner in innerClasses)
{
string innerId = (string)inner.Attribute("refid");
Expand Down Expand Up @@ -155,14 +155,5 @@ orderby c.Children.Count
}
return htype;
}

private static bool IsFiltered(string prot)
{
if (prot == null)
{
return false;
}
return prot.Contains("private") || prot.Contains("package");
}
}
}
9 changes: 9 additions & 0 deletions src/Microsoft.Content.Build.Code2Yaml.Utility/YamlUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,14 @@ public static string RegularizeName(string name, string nameSpliter)
}
return name.Replace(Constants.NameSpliter, nameSpliter);
}

public static bool IsFiltered(string prot)
{
if (prot == null)
{
return false;
}
return prot.Contains("private") || prot.Contains("package");
}
}
}

0 comments on commit a8790f5

Please sign in to comment.