Skip to content

Commit bc78131

Browse files
committed
Added WasNotUsed to TranslatedFile to check when the file was in-scope but was not actually used for translation.
1 parent 86c5cd8 commit bc78131

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Biohazrd/TranslatedFile.cs

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ public sealed class TranslatedFile : IEquatable<TranslatedFile>
2727
/// <remarks>Out-of-scope files may appear on declarations in certain situations. (Such as when an in-scope declaration contains a nested include to an out-of-scope file.)</remarks>
2828
public bool WasInScope { get; }
2929

30+
/// <summary>True if this file was specified as in-scope to <see cref="TranslatedLibraryBuilder"/> but was not encountered during parsing.</summary>
31+
/// <remarks>A file being unused does not necessarily indicate it was not included. For instance, file containing only comments will be considered unused.</remarks>
32+
public bool WasNotUsed => WasInScope && Handle == IntPtr.Zero;
33+
3034
/// <summary>A dummy translated file which represents synthesized declarations that don't directly correspond to a translated file.</summary>
3135
public static readonly TranslatedFile Synthesized = new TranslatedFile("<>Synthesized", new IntPtr(-1), false);
3236

0 commit comments

Comments
 (0)