Browse Source

Generate file-scoped namespace declarations, if possible.

pull/2560/head
Siegfried Pammer 4 years ago
parent
commit
d8bb40b45b
  1. 7
      ICSharpCode.Decompiler.Tests/Helpers/Tester.cs
  2. 1
      ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj
  3. 17
      ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs
  4. 20
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  5. 25
      ICSharpCode.Decompiler.Tests/TestCases/PdbGen/ForLoopTests.xml
  6. 15
      ICSharpCode.Decompiler.Tests/TestCases/PdbGen/HelloWorld.xml
  7. 23
      ICSharpCode.Decompiler.Tests/TestCases/PdbGen/LambdaCapturing.xml
  8. 9
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/FileScopedNamespaces.cs
  9. 12
      ICSharpCode.Decompiler.Tests/UglyTestRunner.cs
  10. 19
      ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs
  11. 2
      ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs
  12. 25
      ICSharpCode.Decompiler/CSharp/Transforms/NormalizeBlockStatements.cs
  13. 24
      ICSharpCode.Decompiler/DecompilerSettings.cs
  14. 3
      ILSpy/Options/DecompilerSettingsPanel.xaml.cs
  15. 9
      ILSpy/Properties/Resources.Designer.cs
  16. 3
      ILSpy/Properties/Resources.resx

7
ICSharpCode.Decompiler.Tests/Helpers/Tester.cs

@ -549,9 +549,12 @@ namespace ICSharpCode.Decompiler.Tests.Helpers
CompilerOptions.UseRoslyn1_3_2 => CSharp.LanguageVersion.CSharp6, CompilerOptions.UseRoslyn1_3_2 => CSharp.LanguageVersion.CSharp6,
CompilerOptions.UseRoslyn2_10_0 => CSharp.LanguageVersion.CSharp7_3, CompilerOptions.UseRoslyn2_10_0 => CSharp.LanguageVersion.CSharp7_3,
CompilerOptions.UseRoslyn3_11_0 => CSharp.LanguageVersion.CSharp9_0, CompilerOptions.UseRoslyn3_11_0 => CSharp.LanguageVersion.CSharp9_0,
_ => cscOptions.HasFlag(CompilerOptions.Preview) ? CSharp.LanguageVersion.Latest : CSharp.LanguageVersion.CSharp9_0, _ => cscOptions.HasFlag(CompilerOptions.Preview) ? CSharp.LanguageVersion.Latest : CSharp.LanguageVersion.CSharp10_0,
};
return new DecompilerSettings(langVersion) {
// Never use file-scoped namespaces
FileScopedNamespaces = false
}; };
return new DecompilerSettings(langVersion);
} }
else else
{ {

1
ICSharpCode.Decompiler.Tests/ICSharpCode.Decompiler.Tests.csproj

@ -108,6 +108,7 @@
<Compile Include="TestCases\Correctness\DeconstructionTests.cs" /> <Compile Include="TestCases\Correctness\DeconstructionTests.cs" />
<Compile Include="TestCases\Correctness\DynamicTests.cs" /> <Compile Include="TestCases\Correctness\DynamicTests.cs" />
<Compile Include="TestCases\Correctness\StringConcat.cs" /> <Compile Include="TestCases\Correctness\StringConcat.cs" />
<None Include="TestCases\Pretty\FileScopedNamespaces.cs" />
<Compile Include="TestCases\Pretty\PatternMatching.cs" /> <Compile Include="TestCases\Pretty\PatternMatching.cs" />
<None Include="TestCases\Ugly\NoPropertiesAndEvents.Expected.cs" /> <None Include="TestCases\Ugly\NoPropertiesAndEvents.Expected.cs" />
<Compile Include="TestCases\Ugly\NoPropertiesAndEvents.cs" /> <Compile Include="TestCases\Ugly\NoPropertiesAndEvents.cs" />

17
ICSharpCode.Decompiler.Tests/ILPrettyTestRunner.cs

@ -113,13 +113,13 @@ namespace ICSharpCode.Decompiler.Tests
[Test] [Test]
public void FSharpUsing_Debug() public void FSharpUsing_Debug()
{ {
Run(settings: new DecompilerSettings { RemoveDeadStores = true, UseEnhancedUsing = false }); Run(settings: new DecompilerSettings { RemoveDeadStores = true, UseEnhancedUsing = false, FileScopedNamespaces = false });
} }
[Test] [Test]
public void FSharpUsing_Release() public void FSharpUsing_Release()
{ {
Run(settings: new DecompilerSettings { RemoveDeadStores = true, UseEnhancedUsing = false }); Run(settings: new DecompilerSettings { RemoveDeadStores = true, UseEnhancedUsing = false, FileScopedNamespaces = false });
} }
[Test] [Test]
@ -137,13 +137,13 @@ namespace ICSharpCode.Decompiler.Tests
[Test] [Test]
public void CS1xSwitch_Debug() public void CS1xSwitch_Debug()
{ {
Run(settings: new DecompilerSettings { SwitchExpressions = false }); Run(settings: new DecompilerSettings { SwitchExpressions = false, FileScopedNamespaces = false });
} }
[Test] [Test]
public void CS1xSwitch_Release() public void CS1xSwitch_Release()
{ {
Run(settings: new DecompilerSettings { SwitchExpressions = false }); Run(settings: new DecompilerSettings { SwitchExpressions = false, FileScopedNamespaces = false });
} }
[Test] [Test]
@ -240,14 +240,14 @@ namespace ICSharpCode.Decompiler.Tests
public void FSharpLoops_Debug() public void FSharpLoops_Debug()
{ {
CopyFSharpCoreDll(); CopyFSharpCoreDll();
Run(settings: new DecompilerSettings { RemoveDeadStores = true }); Run(settings: new DecompilerSettings { RemoveDeadStores = true, FileScopedNamespaces = false });
} }
[Test] [Test]
public void FSharpLoops_Release() public void FSharpLoops_Release()
{ {
CopyFSharpCoreDll(); CopyFSharpCoreDll();
Run(settings: new DecompilerSettings { RemoveDeadStores = true }); Run(settings: new DecompilerSettings { RemoveDeadStores = true, FileScopedNamespaces = false });
} }
[Test] [Test]
@ -259,6 +259,11 @@ namespace ICSharpCode.Decompiler.Tests
void Run([CallerMemberName] string testName = null, DecompilerSettings settings = null, void Run([CallerMemberName] string testName = null, DecompilerSettings settings = null,
AssemblerOptions assemblerOptions = AssemblerOptions.Library) AssemblerOptions assemblerOptions = AssemblerOptions.Library)
{ {
if (settings == null)
{
// never use file-scoped namespaces, unless explicitly specified
settings = new DecompilerSettings { FileScopedNamespaces = false };
}
var ilFile = Path.Combine(TestCasePath, testName + ".il"); var ilFile = Path.Combine(TestCasePath, testName + ".il");
var csFile = Path.Combine(TestCasePath, testName + ".cs"); var csFile = Path.Combine(TestCasePath, testName + ".cs");

20
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -180,7 +180,8 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings {
NullPropagation = false, NullPropagation = false,
// legacy csc generates a dead store in debug builds // legacy csc generates a dead store in debug builds
RemoveDeadStores = (cscOptions == CompilerOptions.None) RemoveDeadStores = (cscOptions == CompilerOptions.None),
FileScopedNamespaces = false,
}); });
} }
@ -191,6 +192,7 @@ namespace ICSharpCode.Decompiler.Tests
// legacy csc generates a dead store in debug builds // legacy csc generates a dead store in debug builds
RemoveDeadStores = (cscOptions == CompilerOptions.None), RemoveDeadStores = (cscOptions == CompilerOptions.None),
SwitchExpressions = false, SwitchExpressions = false,
FileScopedNamespaces = false,
}); });
} }
@ -235,7 +237,10 @@ namespace ICSharpCode.Decompiler.Tests
{ {
RunForLibrary( RunForLibrary(
cscOptions: cscOptions, cscOptions: cscOptions,
decompilerSettings: new DecompilerSettings { UseEnhancedUsing = false } decompilerSettings: new DecompilerSettings {
UseEnhancedUsing = false,
FileScopedNamespaces = false,
}
); );
} }
@ -263,7 +268,8 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings {
// legacy csc generates a dead store in debug builds // legacy csc generates a dead store in debug builds
RemoveDeadStores = (cscOptions == CompilerOptions.None), RemoveDeadStores = (cscOptions == CompilerOptions.None),
UseExpressionBodyForCalculatedGetterOnlyProperties = false UseExpressionBodyForCalculatedGetterOnlyProperties = false,
FileScopedNamespaces = false,
}); });
} }
@ -407,7 +413,7 @@ namespace ICSharpCode.Decompiler.Tests
{ {
RunForLibrary( RunForLibrary(
cscOptions: cscOptions, cscOptions: cscOptions,
decompilerSettings: new DecompilerSettings { UseEnhancedUsing = false } decompilerSettings: new DecompilerSettings { UseEnhancedUsing = false, FileScopedNamespaces = false }
); );
} }
@ -429,6 +435,12 @@ namespace ICSharpCode.Decompiler.Tests
RunForLibrary(cscOptions: cscOptions | CompilerOptions.Preview); RunForLibrary(cscOptions: cscOptions | CompilerOptions.Preview);
} }
[Test]
public void FileScopedNamespaces([ValueSource(nameof(roslynLatestOnlyOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings());
}
[Test] [Test]
public void FunctionPointers([ValueSource(nameof(roslynLatestOnlyOptions))] CompilerOptions cscOptions) public void FunctionPointers([ValueSource(nameof(roslynLatestOnlyOptions))] CompilerOptions cscOptions)
{ {

25
ICSharpCode.Decompiler.Tests/TestCases/PdbGen/ForLoopTests.xml

@ -3,26 +3,25 @@
<files> <files>
<file id="1" name="ICSharpCode\Decompiler\Tests\TestCases\PdbGen\ForLoopTests.cs" language="C#" checksumAlgorithm="SHA256"><![CDATA[using System; <file id="1" name="ICSharpCode\Decompiler\Tests\TestCases\PdbGen\ForLoopTests.cs" language="C#" checksumAlgorithm="SHA256"><![CDATA[using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.PdbGen namespace ICSharpCode.Decompiler.Tests.TestCases.PdbGen;
public class ForLoopTests
{ {
public class ForLoopTests public static void SimplePrintLoop(string[] args)
{ {
public static void SimplePrintLoop(string[] args) for (int i = 0; i < args.Length; i++)
{ {
for (int i = 0; i < args.Length; i++) Console.WriteLine(args[i]);
{
Console.WriteLine(args[i]);
}
} }
}
public static void SimplePrintLoopWithCondition(string[] args) public static void SimplePrintLoopWithCondition(string[] args)
{
for (int i = 0; i < args.Length; i++)
{ {
for (int i = 0; i < args.Length; i++) if (i % 2 != 0)
{ {
if (i % 2 != 0) Console.WriteLine(args[i]);
{
Console.WriteLine(args[i]);
}
} }
} }
} }

15
ICSharpCode.Decompiler.Tests/TestCases/PdbGen/HelloWorld.xml

@ -3,16 +3,15 @@
<files> <files>
<file id="1" name="ICSharpCode\Decompiler\Tests\TestCases\PdbGen\HelloWorld.cs" language="C#" checksumAlgorithm="SHA256"><![CDATA[using System; <file id="1" name="ICSharpCode\Decompiler\Tests\TestCases\PdbGen\HelloWorld.cs" language="C#" checksumAlgorithm="SHA256"><![CDATA[using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.PdbGen namespace ICSharpCode.Decompiler.Tests.TestCases.PdbGen;
public class HelloWorld
{ {
public class HelloWorld public static void Main(string[] args)
{ {
public static void Main(string[] args) Console.ReadKey();
{ Console.WriteLine("Hello World!");
Console.ReadKey(); Console.ReadKey();
Console.WriteLine("Hello World!");
Console.ReadKey();
}
} }
} }
]]></file> ]]></file>

23
ICSharpCode.Decompiler.Tests/TestCases/PdbGen/LambdaCapturing.xml

@ -3,21 +3,20 @@
<files> <files>
<file id="1" name="ICSharpCode\Decompiler\Tests\TestCases\PdbGen\LambdaCapturing.cs" language="C#" checksumAlgorithm="SHA256"><![CDATA[using System; <file id="1" name="ICSharpCode\Decompiler\Tests\TestCases\PdbGen\LambdaCapturing.cs" language="C#" checksumAlgorithm="SHA256"><![CDATA[using System;
namespace ICSharpCode.Decompiler.Tests.TestCases.PdbGen namespace ICSharpCode.Decompiler.Tests.TestCases.PdbGen;
public class LambdaCapturing
{ {
public class LambdaCapturing public static void Main(string[] args)
{ {
public static void Main(string[] args) int num = 4;
{ int captured = Environment.TickCount + num;
int num = 4; Test((int a, int b) => a + b + captured);
int captured = Environment.TickCount + num; }
Test((int a, int b) => a + b + captured);
}
private static void Test(Func<int, int, int> p) private static void Test(Func<int, int, int> p)
{ {
p(1, 2); p(1, 2);
}
} }
} }
]]></file> ]]></file>

9
ICSharpCode.Decompiler.Tests/TestCases/Pretty/FileScopedNamespaces.cs

@ -0,0 +1,9 @@
namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty;
internal delegate void DelegateInFileScopedNamespace();
internal class FileScopedNamespaces
{
}

12
ICSharpCode.Decompiler.Tests/UglyTestRunner.cs

@ -74,7 +74,7 @@ namespace ICSharpCode.Decompiler.Tests
[Test] [Test]
public void NoArrayInitializers([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions) public void NoArrayInitializers([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
{ {
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings(CSharp.LanguageVersion.CSharp1) {
ArrayInitializers = false ArrayInitializers = false
}); });
} }
@ -82,7 +82,7 @@ namespace ICSharpCode.Decompiler.Tests
[Test] [Test]
public void NoDecimalConstants([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions) public void NoDecimalConstants([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
{ {
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings(CSharp.LanguageVersion.CSharp1) {
DecimalConstants = false DecimalConstants = false
}); });
} }
@ -90,7 +90,7 @@ namespace ICSharpCode.Decompiler.Tests
[Test] [Test]
public void NoExtensionMethods([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions) public void NoExtensionMethods([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
{ {
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings(CSharp.LanguageVersion.CSharp9_0) {
ExtensionMethods = false ExtensionMethods = false
}); });
} }
@ -98,7 +98,7 @@ namespace ICSharpCode.Decompiler.Tests
[Test] [Test]
public void NoForEachStatement([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions) public void NoForEachStatement([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{ {
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings(CSharp.LanguageVersion.CSharp1) {
ForEachStatement = false, ForEachStatement = false,
UseEnhancedUsing = false, UseEnhancedUsing = false,
}); });
@ -113,7 +113,7 @@ namespace ICSharpCode.Decompiler.Tests
[Test] [Test]
public void NoPropertiesAndEvents([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions) public void NoPropertiesAndEvents([ValueSource(nameof(defaultOptions))] CompilerOptions cscOptions)
{ {
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings(CSharp.LanguageVersion.CSharp1) {
AutomaticEvents = false, AutomaticEvents = false,
AutomaticProperties = false, AutomaticProperties = false,
}); });
@ -122,7 +122,7 @@ namespace ICSharpCode.Decompiler.Tests
[Test] [Test]
public void AggressiveScalarReplacementOfAggregates([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions) public void AggressiveScalarReplacementOfAggregates([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
{ {
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings { RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings(CSharp.LanguageVersion.CSharp3) {
AggressiveScalarReplacementOfAggregates = true AggressiveScalarReplacementOfAggregates = true
}); });
} }

19
ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs

@ -1524,15 +1524,26 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
StartNode(namespaceDeclaration); StartNode(namespaceDeclaration);
WriteKeyword(Roles.NamespaceKeyword); WriteKeyword(Roles.NamespaceKeyword);
namespaceDeclaration.NamespaceName.AcceptVisitor(this); namespaceDeclaration.NamespaceName.AcceptVisitor(this);
OpenBrace(policy.NamespaceBraceStyle); if (namespaceDeclaration.IsFileScoped)
{
Semicolon();
NewLine();
}
else
{
OpenBrace(policy.NamespaceBraceStyle);
}
foreach (var member in namespaceDeclaration.Members) foreach (var member in namespaceDeclaration.Members)
{ {
member.AcceptVisitor(this); member.AcceptVisitor(this);
MaybeNewLinesAfterUsings(member); MaybeNewLinesAfterUsings(member);
} }
CloseBrace(policy.NamespaceBraceStyle); if (!namespaceDeclaration.IsFileScoped)
OptionalSemicolon(namespaceDeclaration.LastChild); {
NewLine(); CloseBrace(policy.NamespaceBraceStyle);
OptionalSemicolon(namespaceDeclaration.LastChild);
NewLine();
}
EndNode(namespaceDeclaration); EndNode(namespaceDeclaration);
} }

2
ICSharpCode.Decompiler/CSharp/Syntax/GeneralScope/NamespaceDeclaration.cs

@ -42,6 +42,8 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
} }
} }
public bool IsFileScoped { get; set; }
public CSharpTokenNode NamespaceToken { public CSharpTokenNode NamespaceToken {
get { return GetChildByRole(Roles.NamespaceKeyword); } get { return GetChildByRole(Roles.NamespaceKeyword); }
} }

25
ICSharpCode.Decompiler/CSharp/Transforms/NormalizeBlockStatements.cs

@ -11,6 +11,31 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
class NormalizeBlockStatements : DepthFirstAstVisitor, IAstTransform class NormalizeBlockStatements : DepthFirstAstVisitor, IAstTransform
{ {
TransformContext context; TransformContext context;
bool hasNamespace;
NamespaceDeclaration singleNamespaceDeclaration;
public override void VisitSyntaxTree(SyntaxTree syntaxTree)
{
singleNamespaceDeclaration = null;
hasNamespace = false;
base.VisitSyntaxTree(syntaxTree);
if (context.Settings.FileScopedNamespaces && singleNamespaceDeclaration != null)
{
singleNamespaceDeclaration.IsFileScoped = true;
}
}
public override void VisitNamespaceDeclaration(NamespaceDeclaration namespaceDeclaration)
{
singleNamespaceDeclaration = null;
if (!hasNamespace)
{
hasNamespace = true;
singleNamespaceDeclaration = namespaceDeclaration;
}
base.VisitNamespaceDeclaration(namespaceDeclaration);
}
public override void VisitIfElseStatement(IfElseStatement ifElseStatement) public override void VisitIfElseStatement(IfElseStatement ifElseStatement)
{ {

24
ICSharpCode.Decompiler/DecompilerSettings.cs

@ -142,10 +142,16 @@ namespace ICSharpCode.Decompiler
usePrimaryConstructorSyntax = false; usePrimaryConstructorSyntax = false;
covariantReturns = false; covariantReturns = false;
} }
if (languageVersion < CSharp.LanguageVersion.CSharp10_0)
{
fileScopedNamespaces = false;
}
} }
public CSharp.LanguageVersion GetMinimumRequiredVersion() public CSharp.LanguageVersion GetMinimumRequiredVersion()
{ {
if (fileScopedNamespaces)
return CSharp.LanguageVersion.CSharp10_0;
if (nativeIntegers || initAccessors || functionPointers || forEachWithGetEnumeratorExtension if (nativeIntegers || initAccessors || functionPointers || forEachWithGetEnumeratorExtension
|| recordClasses || withExpressions || usePrimaryConstructorSyntax || covariantReturns) || recordClasses || withExpressions || usePrimaryConstructorSyntax || covariantReturns)
return CSharp.LanguageVersion.CSharp9_0; return CSharp.LanguageVersion.CSharp9_0;
@ -323,6 +329,24 @@ namespace ICSharpCode.Decompiler
} }
} }
bool fileScopedNamespaces = true;
/// <summary>
/// Use C# 10 file-scoped namespaces.
/// </summary>
[Category("C# 10.0 / VS 2022")]
[Description("DecompilerSettings.FileScopedNamespaces")]
public bool FileScopedNamespaces {
get { return fileScopedNamespaces; }
set {
if (fileScopedNamespaces != value)
{
fileScopedNamespaces = value;
OnPropertyChanged();
}
}
}
bool anonymousMethods = true; bool anonymousMethods = true;
/// <summary> /// <summary>

3
ILSpy/Options/DecompilerSettingsPanel.xaml.cs

@ -26,6 +26,7 @@ using System.Windows.Data;
using System.Xml.Linq; using System.Xml.Linq;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Options namespace ICSharpCode.ILSpy.Options
{ {
@ -157,7 +158,7 @@ namespace ICSharpCode.ILSpy.Options
Settings = typeof(Decompiler.DecompilerSettings).GetProperties() Settings = typeof(Decompiler.DecompilerSettings).GetProperties()
.Where(p => p.GetCustomAttribute<BrowsableAttribute>()?.Browsable != false) .Where(p => p.GetCustomAttribute<BrowsableAttribute>()?.Browsable != false)
.Select(p => new CSharpDecompilerSetting(p) { IsEnabled = (bool)p.GetValue(settings) }) .Select(p => new CSharpDecompilerSetting(p) { IsEnabled = (bool)p.GetValue(settings) })
.OrderBy(item => item.Category) .OrderBy(item => item.Category, NaturalStringComparer.Instance)
.ThenBy(item => item.Description) .ThenBy(item => item.Description)
.ToArray(); .ToArray();
} }

9
ILSpy/Properties/Resources.Designer.cs generated

@ -954,6 +954,15 @@ namespace ICSharpCode.ILSpy.Properties {
} }
} }
/// <summary>
/// Looks up a localized string similar to Use file-scoped namespace declarations.
/// </summary>
public static string DecompilerSettings_FileScopedNamespaces {
get {
return ResourceManager.GetString("DecompilerSettings.FileScopedNamespaces", resourceCulture);
}
}
/// <summary> /// <summary>
/// Looks up a localized string similar to Transform to for, if possible. /// Looks up a localized string similar to Transform to for, if possible.
/// </summary> /// </summary>

3
ILSpy/Properties/Resources.resx

@ -345,6 +345,9 @@ Are you sure you want to continue?</value>
<data name="DecompilerSettings.FSpecificOptions" xml:space="preserve"> <data name="DecompilerSettings.FSpecificOptions" xml:space="preserve">
<value>F#-specific options</value> <value>F#-specific options</value>
</data> </data>
<data name="DecompilerSettings.FileScopedNamespaces" xml:space="preserve">
<value>Use file-scoped namespace declarations</value>
</data>
<data name="DecompilerSettings.ForStatement" xml:space="preserve"> <data name="DecompilerSettings.ForStatement" xml:space="preserve">
<value>Transform to for, if possible</value> <value>Transform to for, if possible</value>
</data> </data>

Loading…
Cancel
Save