From 5b8446c6197c6e34a7d0dfca92a4db6726dc6c0f Mon Sep 17 00:00:00 2001
From: ds5678 <49847914+ds5678@users.noreply.github.com>
Date: Mon, 5 May 2025 13:04:48 -0700
Subject: [PATCH] Rename and add documentation
---
.../CSharp/Syntax/TypeSystemAstBuilder.cs | 2 +-
ICSharpCode.Decompiler/TypeSystem/IParameter.cs | 12 +++++++++++-
.../TypeSystem/Implementation/MetadataParameter.cs | 2 +-
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs b/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs
index b95655ba5..119185bc5 100644
--- a/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs
+++ b/ICSharpCode.Decompiler/CSharp/Syntax/TypeSystemAstBuilder.cs
@@ -1735,7 +1735,7 @@ namespace ICSharpCode.Decompiler.CSharp.Syntax
{
decl.Name = parameter.Name;
}
- if (parameter.GetDefaultValueAssignmentAllowed() && this.ShowConstantValues)
+ if (parameter.IsDefaultValueAssignmentAllowed() && this.ShowConstantValues)
{
try
{
diff --git a/ICSharpCode.Decompiler/TypeSystem/IParameter.cs b/ICSharpCode.Decompiler/TypeSystem/IParameter.cs
index 923ec06e3..530f2406a 100644
--- a/ICSharpCode.Decompiler/TypeSystem/IParameter.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/IParameter.cs
@@ -108,7 +108,17 @@ namespace ICSharpCode.Decompiler.TypeSystem
internal static class IParameterExtensions
{
- public static bool GetDefaultValueAssignmentAllowed(this IParameter parameter)
+ ///
+ /// Checks if the parameter is allowed to be assigned a default value.
+ ///
+ ///
+ /// This checks , , ,
+ /// and on this parameter and all subsequent parameters.
+ /// If the parameter has no , it does not check subsequent parameters.
+ ///
+ /// The parameter
+ /// True if the has a default value and is allowed to be assigned a default value.
+ public static bool IsDefaultValueAssignmentAllowed(this IParameter parameter)
{
if (!DefaultValueAssignmentAllowedIndividual(parameter))
return false;
diff --git a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataParameter.cs b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataParameter.cs
index 3067f135e..8089b1eae 100644
--- a/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataParameter.cs
+++ b/ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataParameter.cs
@@ -63,7 +63,7 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
var metadata = module.metadata;
var parameter = metadata.GetParameter(handle);
- bool defaultValueAssignmentAllowed = this.GetDefaultValueAssignmentAllowed();
+ bool defaultValueAssignmentAllowed = this.IsDefaultValueAssignmentAllowed();
if (IsOptional && !defaultValueAssignmentAllowed)
{