Skip to content

Commit eb7fec6

Browse files
author
Michael Jin
authored
Fix the logic for the shouldDelete factor (#628)
* Fix the logic for the shouldDelete factor * Fix cmd for integration test * Make duplication a considered factor in the deleting
1 parent 4505169 commit eb7fec6

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

mdoc/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ check-monodocer-attached-entities:
751751

752752
# now make sure it will delete a previously run/duplicated attachedproperty/property
753753
cp Test/AttachedEventsAndProperties/AttachedPropertyExample.xml Test/en.actual/AttachedEventsAndProperties/
754-
$(MONO) $(PROGRAM) update -o Test/en.actual Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll -lang docid -lang vb.net -lang fsharp -lang javascript -lang c++/cli -lang c++/cx -lang c++/winrt
754+
$(MONO) $(PROGRAM) update -o Test/en.actual Test/AttachedEventsAndProperties/bin/Release/AttachedEventsAndProperties.dll --delete -lang docid -lang vb.net -lang fsharp -lang javascript -lang c++/cli -lang c++/cx -lang c++/winrt
755755
$(DIFF) Test/en.expected-attached-entities Test/en.actual
756756

757757
Test/TestClass.dll:
@@ -765,7 +765,7 @@ check-monodocer-operators-work: Test/TestClass.dll
765765
rm -Rf Test/en.actual
766766
$(MONO) $(PROGRAM) update Test/TestClass.dll -o Test/en.actual
767767
cp mdoc.Test/SampleClasses/TestClass-OldOpSig.xml Test/en.actual/mdoc.Test.SampleClasses/TestClass.xml
768-
$(MONO) $(PROGRAM) update Test/TestClass.dll -o Test/en.actual
768+
$(MONO) $(PROGRAM) update Test/TestClass.dll -o Test/en.actual --delete
769769

770770
.PHONY: check-monodocer-operators
771771
check-monodocer-operators: check-monodocer-operators-work

mdoc/Mono.Documentation/MDocUpdater.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1939,9 +1939,11 @@ void DeleteMember (string reason, string output, XmlNode member, MyXmlNodeList t
19391939
signature);
19401940

19411941
// Identify all of the different states that could affect our decision to delete the member
1942+
bool duplicated = reason.Contains("Duplicate Member");
19421943
bool shouldPreserve = !string.IsNullOrWhiteSpace (PreserveTag);
19431944
bool hasContent = MemberDocsHaveUserContent (member);
1944-
bool shouldDelete = !shouldPreserve && (delete || !hasContent);
1945+
//When the member is NOT PRESERVED, the member has NO CONTENT or is DUPLICATED, then it should be deleted
1946+
bool shouldDelete = !shouldPreserve && (delete && (!hasContent || duplicated));
19451947

19461948
bool unifiedRun = HasDroppedNamespace (type);
19471949

0 commit comments

Comments
 (0)