diff options
Diffstat (limited to 'modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs')
-rw-r--r-- | modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs index c7fd45238d..35db0d6f10 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs @@ -329,6 +329,11 @@ namespace Godot.SourceGenerators } } + public static Location? FirstLocationWithSourceTreeOrDefault(this IEnumerable<Location> locations) + { + return locations.FirstOrDefault(location => location.SourceTree != null) ?? locations.FirstOrDefault(); + } + public static string Path(this Location location) => location.SourceTree?.GetLineSpan(location.SourceSpan).Path ?? location.GetLineSpan().Path; |