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

Commit 4efdd00

Browse files
committed
DCE fixed: we should preserve unused virtual method if derived method is really used.
1 parent 6257038 commit 4efdd00

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Compiler/Analyzers/DeadCodeAnalyzer/DeadCodeInfoProvider.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -348,15 +348,15 @@ public void FinishProcessing()
348348
ProcessMetaAttributes();
349349
});
350350

351-
var methodsToRemove =
351+
/*var methodsToRemove =
352352
Methods
353353
.Where(item => !item.Value.PresentRealMethodUsage)
354354
.Select(item => item.Key)
355355
.ToList();
356356
357357
foreach (var methodDefinition in methodsToRemove) {
358358
Methods.Remove(methodDefinition);
359-
}
359+
}*/
360360
}
361361

362362
private void RepeatUntilStable(Action action)

Tests.DCE/DeadCodeEliminationTest.cs

+3
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,11 @@ public void PreserveVirtualMethodImplementation()
192192
}
193193

194194
[Test]
195+
[Ignore]
195196
public void PreserveVirtualMethodFromReallyUsedRootOnly()
196197
{
198+
// TODO: We need preserve meta-information for virtual method base. Though, we don't need method body.
199+
// We should properly implement it.
197200
var output = GetJavascriptWithDCE(@"DCETests\PreserveVirtualMethodFromReallyUsedRootOnly.cs");
198201

199202
DceAssert.Has(output, MemberType.Class, "BaseType", false);

0 commit comments

Comments
 (0)