diff options
author | Paul Joannon <hello@pauljoannon.com> | 2022-08-15 10:53:08 +0200 |
---|---|---|
committer | Paul Joannon <hello@pauljoannon.com> | 2022-08-25 20:39:57 +0200 |
commit | cf99d92a392b37a667856cebed30b15ecd347ca6 (patch) | |
tree | c84009d78fe6d15487615be673e69ea5bd8097ec /modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs | |
parent | f03ac21ea8bf04b5ac0243706facdbde45ba7385 (diff) |
C#: Preserve order of exported fields/categories
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 | 8 |
1 files changed, 8 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 d868678179..de3b6c862a 100644 --- a/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs +++ b/modules/mono/editor/Godot.NET.Sdk/Godot.SourceGenerators/ExtensionMethods.cs @@ -275,5 +275,13 @@ namespace Godot.SourceGenerators yield return new GodotFieldData(field, marshalType.Value); } } + + public static string Path(this Location location) + => location.SourceTree?.GetLineSpan(location.SourceSpan).Path + ?? location.GetLineSpan().Path; + + public static int StartLine(this Location location) + => location.SourceTree?.GetLineSpan(location.SourceSpan).StartLinePosition.Line + ?? location.GetLineSpan().StartLinePosition.Line; } } |