Skip to content

Commit db08034

Browse files
committed
Clean up some properties in TranslationUnit.cs with null coalescing operators.
1 parent 598604e commit db08034

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/AST/TranslationUnit.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,14 @@ public TranslationUnit(string file) : this()
3838
private string fileNameWithoutExtension;
3939

4040
/// Contains the name of the file.
41-
public string FileName
42-
{
43-
get { return !IsValid ? FilePath : fileName ?? (fileName = Path.GetFileName(FilePath)); }
44-
}
41+
public string FileName => !IsValid ? FilePath : fileName ??= Path.GetFileName(FilePath);
4542

4643
/// Contains the name of the module.
4744
public string FileNameWithoutExtension
4845
{
4946
get
5047
{
51-
return fileNameWithoutExtension ??
52-
(fileNameWithoutExtension = Path.GetFileNameWithoutExtension(FileName));
48+
return fileNameWithoutExtension ??= Path.GetFileNameWithoutExtension(FileName);
5349
}
5450
}
5551

@@ -83,8 +79,7 @@ public string FileRelativePath
8379
get
8480
{
8581
if (!IsValid) return string.Empty;
86-
return fileRelativePath ??
87-
(fileRelativePath = Path.Combine(FileRelativeDirectory, FileName));
82+
return fileRelativePath ??= Path.Combine(FileRelativeDirectory, FileName);
8883
}
8984
}
9085

0 commit comments

Comments
 (0)