Mark private members as static part 9 (#14234)
https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822
This commit is contained in:
parent
908cf899e1
commit
c909541b77
|
@ -1083,7 +1083,7 @@ namespace System.Management.Automation
|
|||
_rangeKind = kind;
|
||||
}
|
||||
|
||||
private void ValidateRange(object element, ValidateRangeKind rangeKind)
|
||||
private static void ValidateRange(object element, ValidateRangeKind rangeKind)
|
||||
{
|
||||
Type commonType = GetCommonType(typeof(int), element.GetType());
|
||||
if (commonType == null)
|
||||
|
|
|
@ -2450,7 +2450,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
}
|
||||
|
||||
private uint NewParameterSetPromptingData(
|
||||
private static uint NewParameterSetPromptingData(
|
||||
Dictionary<uint, ParameterSetPromptingData> promptingData,
|
||||
MergedCompiledCommandParameter parameter,
|
||||
ParameterSetSpecificMetadata parameterSetMetadata,
|
||||
|
|
|
@ -936,7 +936,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
|
||||
// Helper method to auto complete hashtable key
|
||||
private List<CompletionResult> GetResultForHashtable(CompletionContext completionContext)
|
||||
private static List<CompletionResult> GetResultForHashtable(CompletionContext completionContext)
|
||||
{
|
||||
var lastAst = completionContext.RelatedAsts.Last();
|
||||
HashtableAst tempHashtableAst = null;
|
||||
|
@ -997,7 +997,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
|
||||
// Helper method to look for an incomplete assignment pair in hash table.
|
||||
private bool CheckForPendingAssignment(HashtableAst hashTableAst)
|
||||
private static bool CheckForPendingAssignment(HashtableAst hashTableAst)
|
||||
{
|
||||
foreach (var keyValue in hashTableAst.KeyValuePairs)
|
||||
{
|
||||
|
@ -1065,7 +1065,7 @@ namespace System.Management.Automation
|
|||
return stringToComplete;
|
||||
}
|
||||
|
||||
private Tuple<ExpressionAst, StatementAst> GetHashEntryContainsCursor(
|
||||
private static Tuple<ExpressionAst, StatementAst> GetHashEntryContainsCursor(
|
||||
IScriptPosition cursor,
|
||||
HashtableAst hashTableAst,
|
||||
bool isCursorInString)
|
||||
|
@ -1356,7 +1356,7 @@ namespace System.Management.Automation
|
|||
return GetMatchedResults(allNames, completionContext);
|
||||
}
|
||||
|
||||
private List<CompletionResult> GetResultForEnumPropertyValueOfDSCResource(
|
||||
private static List<CompletionResult> GetResultForEnumPropertyValueOfDSCResource(
|
||||
CompletionContext completionContext,
|
||||
string stringToComplete,
|
||||
ref int replacementIndex,
|
||||
|
@ -1643,7 +1643,7 @@ namespace System.Management.Automation
|
|||
/// <param name="ast"></param>
|
||||
/// <param name="keywordAst"></param>
|
||||
/// <returns></returns>
|
||||
private ConfigurationDefinitionAst GetAncestorConfigurationAstAndKeywordAst(
|
||||
private static ConfigurationDefinitionAst GetAncestorConfigurationAstAndKeywordAst(
|
||||
IScriptPosition cursorPosition,
|
||||
Ast ast,
|
||||
out DynamicKeywordStatementAst keywordAst)
|
||||
|
@ -1679,7 +1679,7 @@ namespace System.Management.Automation
|
|||
/// <param name="keywordAst"></param>
|
||||
/// <param name="matched"></param>
|
||||
/// <returns></returns>
|
||||
private List<CompletionResult> GetResultForIdentifierInConfiguration(
|
||||
private static List<CompletionResult> GetResultForIdentifierInConfiguration(
|
||||
CompletionContext completionContext,
|
||||
ConfigurationDefinitionAst configureAst,
|
||||
DynamicKeywordStatementAst keywordAst,
|
||||
|
@ -2093,7 +2093,7 @@ namespace System.Management.Automation
|
|||
return result;
|
||||
}
|
||||
|
||||
private List<CompletionResult> GetResultForAttributeArgument(CompletionContext completionContext, ref int replacementIndex, ref int replacementLength)
|
||||
private static List<CompletionResult> GetResultForAttributeArgument(CompletionContext completionContext, ref int replacementIndex, ref int replacementLength)
|
||||
{
|
||||
// Attribute member arguments
|
||||
Type attributeType = null;
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace System.Management.Automation
|
|||
/// <returns>
|
||||
/// True if the cmdlet is a special cmdlet that shouldn't be part of the discovery list. Or false otherwise.
|
||||
/// </returns>
|
||||
private bool IsSpecialCmdlet(Type implementingType)
|
||||
private static bool IsSpecialCmdlet(Type implementingType)
|
||||
{
|
||||
// These commands should never be put in the discovery list. They are an internal implementation
|
||||
// detail of the formatting and output component. That component uses these cmdlets by creating
|
||||
|
|
|
@ -842,7 +842,7 @@ namespace System.Management.Automation
|
|||
// Don't return commands to the user if that might result in:
|
||||
// - Trusted commands calling untrusted functions that the user has overridden
|
||||
// - Debug prompts calling internal functions that are likely to have code injection
|
||||
private bool ShouldSkipCommandResolutionForConstrainedLanguage(CommandInfo? result, ExecutionContext executionContext)
|
||||
private static bool ShouldSkipCommandResolutionForConstrainedLanguage(CommandInfo? result, ExecutionContext executionContext)
|
||||
{
|
||||
if (result == null)
|
||||
{
|
||||
|
|
|
@ -309,7 +309,7 @@ namespace System.Management.Automation
|
|||
return exist;
|
||||
}
|
||||
|
||||
private bool isUnsigned(Type type)
|
||||
private static bool isUnsigned(Type type)
|
||||
{
|
||||
return (type == typeof(ulong) || type == typeof(uint) || type == typeof(ushort) || type == typeof(byte));
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ namespace System.Management.Automation
|
|||
/// <returns>
|
||||
/// A generic list of tokenized input.
|
||||
/// </returns>
|
||||
private List<Token> TokenizeInput(string input)
|
||||
private static List<Token> TokenizeInput(string input)
|
||||
{
|
||||
List<Token> tokenList = new List<Token>();
|
||||
int _offset = 0;
|
||||
|
@ -412,7 +412,7 @@ namespace System.Management.Automation
|
|||
/// <param name="_offset">
|
||||
/// Current offset position for the string parser.
|
||||
/// </param>
|
||||
private void FindNextToken(string input, ref int _offset)
|
||||
private static void FindNextToken(string input, ref int _offset)
|
||||
{
|
||||
while (_offset < input.Length)
|
||||
{
|
||||
|
@ -439,7 +439,7 @@ namespace System.Management.Automation
|
|||
/// <returns>
|
||||
/// The next token on the input string
|
||||
/// </returns>
|
||||
private Token GetNextToken(string input, ref int _offset)
|
||||
private static Token GetNextToken(string input, ref int _offset)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
// bool singleQuoted = false;
|
||||
|
@ -522,7 +522,7 @@ namespace System.Management.Automation
|
|||
/// <param name="tokenList">
|
||||
/// A list of tokenized input.
|
||||
/// </param>
|
||||
private void CheckSyntaxError(List<Token> tokenList)
|
||||
private static void CheckSyntaxError(List<Token> tokenList)
|
||||
{
|
||||
// Initialize, assuming preceded by OR
|
||||
TokenKind previous = TokenKind.Or;
|
||||
|
@ -577,7 +577,7 @@ namespace System.Management.Automation
|
|||
/// <param name="tokenList">
|
||||
/// Tokenized list of the input string.
|
||||
/// </param>
|
||||
private Node ConstructExpressionTree(List<Token> tokenList)
|
||||
private static Node ConstructExpressionTree(List<Token> tokenList)
|
||||
{
|
||||
bool notFlag = false;
|
||||
Queue<Node> andQueue = new Queue<Node>();
|
||||
|
|
|
@ -2584,7 +2584,7 @@ namespace System.Management.Automation.Runspaces
|
|||
return null;
|
||||
}
|
||||
|
||||
private string[] GetModulesForUnResolvedCommands(IEnumerable<string> unresolvedCommands, ExecutionContext context)
|
||||
private static string[] GetModulesForUnResolvedCommands(IEnumerable<string> unresolvedCommands, ExecutionContext context)
|
||||
{
|
||||
Collection<string> modulesToImport = new Collection<string>();
|
||||
HashSet<string> commandsToResolve = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
@ -3072,7 +3072,7 @@ namespace System.Management.Automation.Runspaces
|
|||
/// <param name="moduleName"></param>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
private IEnumerable<CommandInfo> LookupCommands(
|
||||
private static IEnumerable<CommandInfo> LookupCommands(
|
||||
string commandPattern,
|
||||
string moduleName,
|
||||
ExecutionContext context)
|
||||
|
|
|
@ -77,7 +77,7 @@ namespace System.Management.Automation
|
|||
/// <param name="dotnetBaseType"></param>
|
||||
/// <param name="shouldIncludeNamespace"></param>
|
||||
/// <returns></returns>
|
||||
private IEnumerable<string> GetTypeNameHierarchyFromDerivation(ManagementBaseObject managementObj,
|
||||
private static IEnumerable<string> GetTypeNameHierarchyFromDerivation(ManagementBaseObject managementObj,
|
||||
string dotnetBaseType, bool shouldIncludeNamespace)
|
||||
{
|
||||
StringBuilder type = new StringBuilder(200);
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private PSModuleInfo GetModuleInfoForRemoteModuleWithoutManifest(RemoteDiscoveryHelper.CimModule cimModule)
|
||||
private static PSModuleInfo GetModuleInfoForRemoteModuleWithoutManifest(RemoteDiscoveryHelper.CimModule cimModule)
|
||||
{
|
||||
return new PSModuleInfo(cimModule.ModuleName, null, null);
|
||||
}
|
||||
|
|
|
@ -1401,7 +1401,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
return cimModuleFile.FileCode == RemoteDiscoveryHelper.CimFileCode.CmdletizationV1;
|
||||
}
|
||||
|
||||
private IEnumerable<string> CreateCimModuleFiles(
|
||||
private static IEnumerable<string> CreateCimModuleFiles(
|
||||
RemoteDiscoveryHelper.CimModule remoteCimModule,
|
||||
RemoteDiscoveryHelper.CimFileCode fileCode,
|
||||
Func<RemoteDiscoveryHelper.CimModuleFile, bool> filesFilter,
|
||||
|
@ -2076,7 +2076,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
return moduleProxyList;
|
||||
}
|
||||
|
||||
private void SetModuleBaseForEngineModules(string moduleName, System.Management.Automation.ExecutionContext context)
|
||||
private static void SetModuleBaseForEngineModules(string moduleName, System.Management.Automation.ExecutionContext context)
|
||||
{
|
||||
// Set modulebase of engine modules to point to $pshome
|
||||
// This is so that Get-Help can load the correct help.
|
||||
|
|
|
@ -1044,7 +1044,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private ErrorRecord CreateModuleNotFoundError(string modulePath)
|
||||
private static ErrorRecord CreateModuleNotFoundError(string modulePath)
|
||||
{
|
||||
string errorMessage = StringUtil.Format(Modules.ModuleNotFoundForGetModule, modulePath);
|
||||
FileNotFoundException fnf = new FileNotFoundException(errorMessage);
|
||||
|
@ -1422,7 +1422,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private ErrorRecord GetErrorRecordIfUnsupportedRootCdxmlAndNestedModuleScenario(
|
||||
private static ErrorRecord GetErrorRecordIfUnsupportedRootCdxmlAndNestedModuleScenario(
|
||||
Hashtable data,
|
||||
string moduleManifestPath,
|
||||
string rootModulePath)
|
||||
|
@ -4222,7 +4222,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Search for a localized psd1 manifest file, using the same algorithm
|
||||
/// as Import-LocalizedData.
|
||||
/// </summary>
|
||||
private ExternalScriptInfo FindLocalizedModuleManifest(string path)
|
||||
private static ExternalScriptInfo FindLocalizedModuleManifest(string path)
|
||||
{
|
||||
string dir = Path.GetDirectoryName(path);
|
||||
string file = Path.GetFileName(path);
|
||||
|
@ -4454,7 +4454,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
}
|
||||
}
|
||||
|
||||
private void SetModuleLoggingInformation(ModuleLoggingGroupPolicyStatus status, PSModuleInfo m, IEnumerable<string> moduleNames)
|
||||
private static void SetModuleLoggingInformation(ModuleLoggingGroupPolicyStatus status, PSModuleInfo m, IEnumerable<string> moduleNames)
|
||||
{
|
||||
// TODO, insivara : What happens when Enabled but none of the other options (DefaultSystemModules, NonDefaultSystemModule, NonSystemModule, SpecificModules) are set?
|
||||
// After input from GP team for this behavior, need to revisit the commented out part
|
||||
|
@ -6104,7 +6104,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
|
||||
private static readonly object s_lockObject = new object();
|
||||
|
||||
private void ClearAnalysisCaches()
|
||||
private static void ClearAnalysisCaches()
|
||||
{
|
||||
lock (s_lockObject)
|
||||
{
|
||||
|
|
|
@ -534,7 +534,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// </summary>
|
||||
/// <param name="name">The string to quote.</param>
|
||||
/// <returns>The quoted string.</returns>
|
||||
private string QuoteName(string name)
|
||||
private static string QuoteName(string name)
|
||||
{
|
||||
if (name == null)
|
||||
return "''";
|
||||
|
@ -546,7 +546,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// </summary>
|
||||
/// <param name="name">The Uri to quote.</param>
|
||||
/// <returns>The quoted AbsoluteUri.</returns>
|
||||
private string QuoteName(Uri name)
|
||||
private static string QuoteName(Uri name)
|
||||
{
|
||||
if (name == null)
|
||||
return "''";
|
||||
|
@ -558,7 +558,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// </summary>
|
||||
/// <param name="name">The Version object to quote.</param>
|
||||
/// <returns>The quoted Version string.</returns>
|
||||
private string QuoteName(Version name)
|
||||
private static string QuoteName(Version name)
|
||||
{
|
||||
if (name == null)
|
||||
return "''";
|
||||
|
@ -572,7 +572,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <param name="names">The list to quote.</param>
|
||||
/// <param name="streamWriter">Streamwriter to get end of line character from.</param>
|
||||
/// <returns>The quoted list.</returns>
|
||||
private string QuoteNames(IEnumerable names, StreamWriter streamWriter)
|
||||
private static string QuoteNames(IEnumerable names, StreamWriter streamWriter)
|
||||
{
|
||||
if (names == null)
|
||||
return "@()";
|
||||
|
@ -622,7 +622,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// </summary>
|
||||
/// <param name="moduleSpecs"></param>
|
||||
/// <returns></returns>
|
||||
private IEnumerable PreProcessModuleSpec(IEnumerable moduleSpecs)
|
||||
private static IEnumerable PreProcessModuleSpec(IEnumerable moduleSpecs)
|
||||
{
|
||||
if (moduleSpecs != null)
|
||||
{
|
||||
|
@ -647,7 +647,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// <param name="moduleSpecs">The list to quote.</param>
|
||||
/// <param name="streamWriter">Streamwriter to get end of line character from.</param>
|
||||
/// <returns>The quoted list.</returns>
|
||||
private string QuoteModules(IEnumerable moduleSpecs, StreamWriter streamWriter)
|
||||
private static string QuoteModules(IEnumerable moduleSpecs, StreamWriter streamWriter)
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
result.Append("@(");
|
||||
|
@ -897,7 +897,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
_indent, resourceString, streamWriter.NewLine, key, value);
|
||||
}
|
||||
|
||||
private string ManifestComment(string insert, StreamWriter streamWriter)
|
||||
private static string ManifestComment(string insert, StreamWriter streamWriter)
|
||||
{
|
||||
// Prefix a non-empty string with a space for formatting reasons...
|
||||
if (!string.IsNullOrEmpty(insert))
|
||||
|
|
|
@ -581,7 +581,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
}
|
||||
|
||||
private bool IsScriptModuleFile(string path)
|
||||
private static bool IsScriptModuleFile(string path)
|
||||
{
|
||||
var ext = System.IO.Path.GetExtension(path);
|
||||
return ext != null && s_scriptModuleExtensions.Contains(ext);
|
||||
|
|
|
@ -462,7 +462,7 @@ namespace System.Management.Automation
|
|||
//
|
||||
// It also only populates the bound parameters for a limited set of parameters needed
|
||||
// for module analysis.
|
||||
private Hashtable DoPsuedoParameterBinding(CommandAst commandAst, string commandName)
|
||||
private static Hashtable DoPsuedoParameterBinding(CommandAst commandAst, string commandName)
|
||||
{
|
||||
var result = new Hashtable(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
|
|
|
@ -404,7 +404,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// </summary>
|
||||
/// <param name="assemblyName"></param>
|
||||
/// <returns></returns>
|
||||
private bool IsValidGacAssembly(string assemblyName)
|
||||
private static bool IsValidGacAssembly(string assemblyName)
|
||||
{
|
||||
#if UNIX
|
||||
return false;
|
||||
|
|
|
@ -1169,7 +1169,7 @@ namespace System.Management.Automation
|
|||
return startInfo;
|
||||
}
|
||||
|
||||
private bool IsDownstreamOutDefault(Pipe downstreamPipe)
|
||||
private static bool IsDownstreamOutDefault(Pipe downstreamPipe)
|
||||
{
|
||||
Diagnostics.Assert(downstreamPipe != null, "Caller makes sure the passed-in parameter is not null.");
|
||||
|
||||
|
@ -1316,6 +1316,10 @@ namespace System.Management.Automation
|
|||
|
||||
// On Windows, check the extension list and see if we should try to execute this directly.
|
||||
// Otherwise, use the platform library to check executability
|
||||
[SuppressMessage(
|
||||
"Performance",
|
||||
"CA1822:Mark members as static",
|
||||
Justification = "Accesses instance members in preprocessor branch.")]
|
||||
private bool IsExecutable(string path)
|
||||
{
|
||||
#if UNIX
|
||||
|
|
|
@ -288,7 +288,7 @@ namespace System.Management.Automation
|
|||
return modules;
|
||||
}
|
||||
|
||||
private PSClassInfo ConvertToClassInfo(PSModuleInfo module, ScriptBlockAst ast, TypeDefinitionAst statement)
|
||||
private static PSClassInfo ConvertToClassInfo(PSModuleInfo module, ScriptBlockAst ast, TypeDefinitionAst statement)
|
||||
{
|
||||
PSClassInfo classInfo = new PSClassInfo(statement.Name);
|
||||
Dbg.Assert(statement.Name != null, "statement should have a name.");
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace System.Management.Automation.Configuration
|
|||
WriteValueToFile<string>(scope, key, executionPolicy);
|
||||
}
|
||||
|
||||
private string GetExecutionPolicySettingKey(string shellId)
|
||||
private static string GetExecutionPolicySettingKey(string shellId)
|
||||
{
|
||||
return string.Equals(shellId, Utils.DefaultPowerShellShellID, StringComparison.Ordinal)
|
||||
? ExecutionPolicyDefaultShellKey
|
||||
|
|
|
@ -299,7 +299,7 @@ namespace System.Management.Automation.Internal
|
|||
CopyVariableToTempPipe(VariableStreamKind.Information, _informationVariableList, tempPipe);
|
||||
}
|
||||
|
||||
private void CopyVariableToTempPipe(VariableStreamKind streamKind, List<IList> variableList, Pipe tempPipe)
|
||||
private static void CopyVariableToTempPipe(VariableStreamKind streamKind, List<IList> variableList, Pipe tempPipe)
|
||||
{
|
||||
if (variableList != null && variableList.Count > 0)
|
||||
{
|
||||
|
|
|
@ -389,7 +389,7 @@ namespace System.Management.Automation
|
|||
return checkPathVisibility(Applications, applicationPath);
|
||||
}
|
||||
|
||||
private SessionStateEntryVisibility checkPathVisibility(List<string> list, string path)
|
||||
private static SessionStateEntryVisibility checkPathVisibility(List<string> list, string path)
|
||||
{
|
||||
if (list == null || list.Count == 0) return SessionStateEntryVisibility.Private;
|
||||
if (string.IsNullOrEmpty(path)) return SessionStateEntryVisibility.Private;
|
||||
|
|
|
@ -2061,7 +2061,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
|
||||
// Detect if the GetChildItemDynamicParameters has been overridden.
|
||||
private bool HasGetChildItemDynamicParameters(ProviderInfo providerInfo)
|
||||
private static bool HasGetChildItemDynamicParameters(ProviderInfo providerInfo)
|
||||
{
|
||||
Type providerType = providerInfo.ImplementingType;
|
||||
|
||||
|
@ -4776,7 +4776,7 @@ namespace System.Management.Automation
|
|||
|
||||
// This function validates a remote path, and if it exists, it returns the root path.
|
||||
//
|
||||
private string ValidateRemotePathAndGetRoot(string path, Runspaces.PSSession session, CmdletProviderContext context, PSLanguageMode? languageMode, bool sourceIsRemote)
|
||||
private static string ValidateRemotePathAndGetRoot(string path, Runspaces.PSSession session, CmdletProviderContext context, PSLanguageMode? languageMode, bool sourceIsRemote)
|
||||
{
|
||||
Hashtable op = null;
|
||||
|
||||
|
@ -4892,7 +4892,7 @@ namespace System.Management.Automation
|
|||
return root;
|
||||
}
|
||||
|
||||
private bool isValidSession(PSSession session, CmdletProviderContext context, out PSLanguageMode? languageMode)
|
||||
private static bool isValidSession(PSSession session, CmdletProviderContext context, out PSLanguageMode? languageMode)
|
||||
{
|
||||
// session == null is validated by the parameter binding
|
||||
if (session.Availability != RunspaceAvailability.Available)
|
||||
|
|
|
@ -220,7 +220,7 @@ namespace System.Management.Automation
|
|||
return GetFunction(name, CommandOrigin.Internal);
|
||||
}
|
||||
|
||||
private IEnumerable<string> GetFunctionAliases(IParameterMetadataProvider ipmp)
|
||||
private static IEnumerable<string> GetFunctionAliases(IParameterMetadataProvider ipmp)
|
||||
{
|
||||
if (ipmp == null || ipmp.Body.ParamBlock == null)
|
||||
yield break;
|
||||
|
|
|
@ -190,7 +190,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
}
|
||||
|
||||
private string AddQualifier(string path, ProviderInfo provider, string qualifier, bool isProviderQualified, bool isDriveQualified)
|
||||
private static string AddQualifier(string path, ProviderInfo provider, string qualifier, bool isProviderQualified, bool isDriveQualified)
|
||||
{
|
||||
string result = path;
|
||||
|
||||
|
@ -640,7 +640,7 @@ namespace System.Management.Automation
|
|||
/// </summary>
|
||||
/// <param name="c">The character to test.</param>
|
||||
/// <returns>True if the character is a path separator.</returns>
|
||||
private bool IsPathSeparator(char c)
|
||||
private static bool IsPathSeparator(char c)
|
||||
{
|
||||
return c == StringLiterals.DefaultPathSeparator || c == StringLiterals.AlternatePathSeparator;
|
||||
}
|
||||
|
|
|
@ -1816,7 +1816,7 @@ namespace System.Management.Automation
|
|||
return result;
|
||||
}
|
||||
|
||||
private void GetScopeVariableTable(SessionStateScope scope, Dictionary<string, PSVariable> result, bool includePrivate)
|
||||
private static void GetScopeVariableTable(SessionStateScope scope, Dictionary<string, PSVariable> result, bool includePrivate)
|
||||
{
|
||||
foreach (KeyValuePair<string, PSVariable> entry in scope.Variables)
|
||||
{
|
||||
|
|
|
@ -895,7 +895,7 @@ namespace System.Management.Automation
|
|||
/// <returns>
|
||||
/// Attribute's proxy string.
|
||||
/// </returns>
|
||||
private string GetProxyAttributeData(Attribute attrib, string prefix)
|
||||
private static string GetProxyAttributeData(Attribute attrib, string prefix)
|
||||
{
|
||||
string result;
|
||||
|
||||
|
@ -1367,7 +1367,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
}
|
||||
|
||||
private void CheckForReservedParameter(string name)
|
||||
private static void CheckForReservedParameter(string name)
|
||||
{
|
||||
if (name.Equals("SelectProperty", StringComparison.OrdinalIgnoreCase)
|
||||
||
|
||||
|
|
|
@ -277,7 +277,7 @@ namespace System.Management.Automation.Runspaces
|
|||
}
|
||||
}
|
||||
|
||||
private bool CheckStandardPropertySet(TypeMemberData member, TypeData typeData, Action<TypeData, PropertySetData> setter)
|
||||
private static bool CheckStandardPropertySet(TypeMemberData member, TypeData typeData, Action<TypeData, PropertySetData> setter)
|
||||
{
|
||||
var propertySet = member as PropertySetData;
|
||||
if (propertySet != null)
|
||||
|
@ -4567,7 +4567,7 @@ namespace System.Management.Automation.Runspaces
|
|||
/// <summary>
|
||||
/// Helper method to load content for a module.
|
||||
/// </summary>
|
||||
private string GetModuleContents(
|
||||
private static string GetModuleContents(
|
||||
string moduleName,
|
||||
string fileToLoad,
|
||||
ConcurrentBag<string> errors,
|
||||
|
|
|
@ -2868,7 +2868,7 @@ namespace System.Management.Automation
|
|||
return null;
|
||||
}
|
||||
|
||||
private Debugger GetRunspaceDebugger(int runspaceId)
|
||||
private static Debugger GetRunspaceDebugger(int runspaceId)
|
||||
{
|
||||
if (!Runspace.RunspaceDictionary.TryGetValue(runspaceId, out WeakReference<Runspace> wr))
|
||||
{
|
||||
|
@ -4650,7 +4650,7 @@ namespace System.Management.Automation
|
|||
return null;
|
||||
}
|
||||
|
||||
private void RestoreRemoteOutput(object runningCmd)
|
||||
private static void RestoreRemoteOutput(object runningCmd)
|
||||
{
|
||||
if (runningCmd == null) { return; }
|
||||
|
||||
|
@ -4908,7 +4908,7 @@ namespace System.Management.Automation
|
|||
return null;
|
||||
}
|
||||
|
||||
private string FixUpStatementExtent(int startColNum, string stateExtentText)
|
||||
private static string FixUpStatementExtent(int startColNum, string stateExtentText)
|
||||
{
|
||||
Text.StringBuilder sb = new Text.StringBuilder();
|
||||
sb.Append(' ', startColNum);
|
||||
|
@ -4947,7 +4947,7 @@ namespace System.Management.Automation
|
|||
return null;
|
||||
}
|
||||
|
||||
private void RestoreRemoteOutput(object runningCmd)
|
||||
private static void RestoreRemoteOutput(object runningCmd)
|
||||
{
|
||||
if (runningCmd == null) { return; }
|
||||
|
||||
|
@ -5207,7 +5207,7 @@ namespace System.Management.Automation
|
|||
/// <summary>
|
||||
/// Displays the help text for the debugger commands.
|
||||
/// </summary>
|
||||
private void DisplayHelp(PSHost host, IList<PSObject> output)
|
||||
private static void DisplayHelp(PSHost host, IList<PSObject> output)
|
||||
{
|
||||
WriteLine(string.Empty, host, output);
|
||||
WriteLine(StringUtil.Format(DebuggerStrings.StepHelp, StepShortcut, StepCommand), host, output);
|
||||
|
@ -5335,7 +5335,7 @@ namespace System.Management.Automation
|
|||
WriteCR(host, output);
|
||||
}
|
||||
|
||||
private void WriteLine(string line, PSHost host, IList<PSObject> output)
|
||||
private static void WriteLine(string line, PSHost host, IList<PSObject> output)
|
||||
{
|
||||
if (host != null)
|
||||
{
|
||||
|
@ -5348,7 +5348,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
}
|
||||
|
||||
private void WriteCR(PSHost host, IList<PSObject> output)
|
||||
private static void WriteCR(PSHost host, IList<PSObject> output)
|
||||
{
|
||||
if (host != null)
|
||||
{
|
||||
|
@ -5361,7 +5361,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
}
|
||||
|
||||
private void WriteErrorLine(string error, PSHost host, IList<PSObject> output)
|
||||
private static void WriteErrorLine(string error, PSHost host, IList<PSObject> output)
|
||||
{
|
||||
if (host != null)
|
||||
{
|
||||
|
|
|
@ -422,7 +422,7 @@ namespace System.Management.Automation.Runspaces
|
|||
}
|
||||
}
|
||||
|
||||
private Pipe GetRedirectionPipe(
|
||||
private static Pipe GetRedirectionPipe(
|
||||
PipelineResultTypes toType,
|
||||
MshCommandRuntime mcr)
|
||||
{
|
||||
|
|
|
@ -755,7 +755,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// Get the current history size.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private int GetHistorySize()
|
||||
private static int GetHistorySize()
|
||||
{
|
||||
int historySize = 0;
|
||||
var executionContext = LocalPipeline.GetExecutionContextFromTLS();
|
||||
|
@ -1315,7 +1315,7 @@ namespace Microsoft.PowerShell.Commands
|
|||
/// in the pipeline. If there are more than one element in pipeline
|
||||
/// (ex A | Invoke-History 2 | B) then we cannot do this replacement.
|
||||
/// </summary>
|
||||
private void ReplaceHistoryString(HistoryInfo entry, LocalRunspace localRunspace)
|
||||
private static void ReplaceHistoryString(HistoryInfo entry, LocalRunspace localRunspace)
|
||||
{
|
||||
var pipeline = (LocalPipeline)localRunspace.GetCurrentlyRunningPipeline();
|
||||
if (pipeline.AddToHistory)
|
||||
|
|
|
@ -49,8 +49,7 @@ namespace System.Management.Automation.Internal.Host
|
|||
_internalRawUI.ThrowNotInteractive();
|
||||
}
|
||||
|
||||
private
|
||||
void
|
||||
private static void
|
||||
ThrowPromptNotInteractive(string promptMessage)
|
||||
{
|
||||
string message = StringUtil.Format(HostInterfaceExceptionsStrings.HostFunctionPromptNotImplemented, promptMessage);
|
||||
|
|
|
@ -941,7 +941,7 @@ namespace System.Management.Automation.Runspaces
|
|||
/// function. If a remote runspace supports disconnect then it will be disconnected
|
||||
/// rather than closed.
|
||||
/// </summary>
|
||||
private void CloseOrDisconnectAllRemoteRunspaces(Func<List<RemoteRunspace>> getRunspaces)
|
||||
private static void CloseOrDisconnectAllRemoteRunspaces(Func<List<RemoteRunspace>> getRunspaces)
|
||||
{
|
||||
List<RemoteRunspace> runspaces = getRunspaces();
|
||||
if (runspaces.Count == 0) { return; }
|
||||
|
|
|
@ -1629,7 +1629,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
|
||||
// Serializes an object, as long as it's not serialized.
|
||||
private PSObject GetSerializedObject(object value)
|
||||
private static PSObject GetSerializedObject(object value)
|
||||
{
|
||||
// This is a safe cast, as this method is only called with "SerializeInput" is set,
|
||||
// and that method throws if the collection type is not PSObject.
|
||||
|
@ -1654,7 +1654,7 @@ namespace System.Management.Automation
|
|||
}
|
||||
}
|
||||
|
||||
private bool SerializationWouldHaveNoEffect(PSObject result)
|
||||
private static bool SerializationWouldHaveNoEffect(PSObject result)
|
||||
{
|
||||
if (result == null)
|
||||
{
|
||||
|
|
|
@ -4931,7 +4931,7 @@ namespace System.Management.Automation
|
|||
/// <summary>
|
||||
/// Verifies the settings for ThreadOptions and ApartmentState.
|
||||
/// </summary>
|
||||
private void VerifyThreadSettings(PSInvocationSettings settings, ApartmentState runspaceApartmentState, PSThreadOptions runspaceThreadOptions, bool isRemote)
|
||||
private static void VerifyThreadSettings(PSInvocationSettings settings, ApartmentState runspaceApartmentState, PSThreadOptions runspaceThreadOptions, bool isRemote)
|
||||
{
|
||||
ApartmentState apartmentState;
|
||||
|
||||
|
@ -5827,7 +5827,7 @@ namespace System.Management.Automation
|
|||
return powerShellAsPSObject;
|
||||
}
|
||||
|
||||
private List<PSObject> CommandsAsListOfPSObjects(CommandCollection commands, Version psRPVersion)
|
||||
private static List<PSObject> CommandsAsListOfPSObjects(CommandCollection commands, Version psRPVersion)
|
||||
{
|
||||
List<PSObject> commandsAsListOfPSObjects = new List<PSObject>(commands.Count);
|
||||
foreach (Command command in commands)
|
||||
|
|
|
@ -925,7 +925,7 @@ namespace System.Management.Automation.Interpreter
|
|||
Emit(GetLoadField(field));
|
||||
}
|
||||
|
||||
private Instruction GetLoadField(FieldInfo field)
|
||||
private static Instruction GetLoadField(FieldInfo field)
|
||||
{
|
||||
lock (s_loadFields)
|
||||
{
|
||||
|
|
|
@ -1025,7 +1025,7 @@ namespace System.Management.Automation.Interpreter
|
|||
|
||||
#region Loops
|
||||
|
||||
private void CompileLoopExpression(Expression expr)
|
||||
private static void CompileLoopExpression(Expression expr)
|
||||
{
|
||||
// var node = (LoopExpression)expr;
|
||||
// var enterLoop = new EnterLoopInstruction(node, _locals, _compilationThreshold, _instructions.Count);
|
||||
|
@ -2004,7 +2004,8 @@ namespace System.Management.Automation.Interpreter
|
|||
case ExpressionType.Index: CompileIndexExpression(expr); break;
|
||||
case ExpressionType.Label: CompileLabelExpression(expr); break;
|
||||
case ExpressionType.RuntimeVariables: CompileRuntimeVariablesExpression(expr); break;
|
||||
case ExpressionType.Loop: CompileLoopExpression(expr); break;
|
||||
case ExpressionType.Loop:
|
||||
CompileLoopExpression(expr); break;
|
||||
case ExpressionType.Switch: CompileSwitchExpression(expr); break;
|
||||
case ExpressionType.Throw: CompileThrowUnaryExpression(expr, expr.Type == typeof(void)); break;
|
||||
case ExpressionType.Try: CompileTryExpression(expr); break;
|
||||
|
|
|
@ -2045,7 +2045,7 @@ namespace System.Management.Automation.Language
|
|||
}
|
||||
}
|
||||
|
||||
private Action<FunctionContext> CompileTree(Expression<Action<FunctionContext>> lambda, CompileInterpretChoice compileInterpretChoice)
|
||||
private static Action<FunctionContext> CompileTree(Expression<Action<FunctionContext>> lambda, CompileInterpretChoice compileInterpretChoice)
|
||||
{
|
||||
if (lambda == null)
|
||||
{
|
||||
|
@ -2589,7 +2589,7 @@ namespace System.Management.Automation.Language
|
|||
return Expression.Lambda<Action<FunctionContext>>(body, funcName, new[] { s_functionContext });
|
||||
}
|
||||
|
||||
private void GenerateTypesAndUsings(ScriptBlockAst rootForDefiningTypesAndUsings, List<Expression> exprs)
|
||||
private static void GenerateTypesAndUsings(ScriptBlockAst rootForDefiningTypesAndUsings, List<Expression> exprs)
|
||||
{
|
||||
// We don't postpone load assemblies, import modules from 'using' to the moment, when enclosed scriptblock is executed.
|
||||
// We do loading, when root of the script is compiled.
|
||||
|
@ -6353,7 +6353,7 @@ namespace System.Management.Automation.Language
|
|||
return nullConditional ? GetNullConditionalWrappedExpression(target, dynamicExprFromBinder) : dynamicExprFromBinder;
|
||||
}
|
||||
|
||||
private Expression InvokeBaseCtorMethod(PSMethodInvocationConstraints constraints, Expression target, IEnumerable<Expression> args)
|
||||
private static Expression InvokeBaseCtorMethod(PSMethodInvocationConstraints constraints, Expression target, IEnumerable<Expression> args)
|
||||
{
|
||||
var callInfo = new CallInfo(args.Count());
|
||||
var binder = PSInvokeBaseCtorBinder.Get(callInfo, constraints);
|
||||
|
|
|
@ -921,7 +921,7 @@ namespace System.Management.Automation.Language
|
|||
(i, n) => ctor.DefineParameter(i, ParameterAttributes.None, n));
|
||||
}
|
||||
|
||||
private string GetMetaDataName(string name, int numberOfParameters)
|
||||
private static string GetMetaDataName(string name, int numberOfParameters)
|
||||
{
|
||||
int currentId = Interlocked.Increment(ref s_globalCounter);
|
||||
string metaDataName = name + "_" + numberOfParameters + "_" + currentId;
|
||||
|
|
|
@ -4574,7 +4574,7 @@ namespace System.Management.Automation.Language
|
|||
return null;
|
||||
}
|
||||
|
||||
private bool TryUseTokenAsSimpleName(Token token)
|
||||
private static bool TryUseTokenAsSimpleName(Token token)
|
||||
{
|
||||
if (token.Kind == TokenKind.Identifier
|
||||
|| token.Kind == TokenKind.DynamicKeyword
|
||||
|
@ -4587,7 +4587,7 @@ namespace System.Management.Automation.Language
|
|||
return false;
|
||||
}
|
||||
|
||||
private void RecordErrorAsts(Ast errAst, ref List<Ast> astsOnError)
|
||||
private static void RecordErrorAsts(Ast errAst, ref List<Ast> astsOnError)
|
||||
{
|
||||
if (errAst == null)
|
||||
{
|
||||
|
@ -4602,7 +4602,7 @@ namespace System.Management.Automation.Language
|
|||
astsOnError.Add(errAst);
|
||||
}
|
||||
|
||||
private void RecordErrorAsts(IEnumerable<Ast> errAsts, ref List<Ast> astsOnError)
|
||||
private static void RecordErrorAsts(IEnumerable<Ast> errAsts, ref List<Ast> astsOnError)
|
||||
{
|
||||
if (errAsts == null || !errAsts.Any())
|
||||
{
|
||||
|
@ -8013,7 +8013,7 @@ namespace System.Management.Automation.Language
|
|||
SaveError(error);
|
||||
}
|
||||
|
||||
private void ReportErrorsAsWarnings(Collection<Exception> errors)
|
||||
private static void ReportErrorsAsWarnings(Collection<Exception> errors)
|
||||
{
|
||||
var executionContext = Runspaces.Runspace.DefaultRunspace.ExecutionContext;
|
||||
if (executionContext != null && executionContext.InternalHost != null && executionContext.InternalHost.UI != null)
|
||||
|
|
|
@ -480,7 +480,7 @@ namespace System.Management.Automation.Language
|
|||
// this can throw, but there really isn't useful information we can add, as the
|
||||
// offending expression will be presented in the case of any failure
|
||||
//
|
||||
private object GetSingleValueFromTarget(object target, object index)
|
||||
private static object GetSingleValueFromTarget(object target, object index)
|
||||
{
|
||||
var targetString = target as string;
|
||||
if (targetString != null)
|
||||
|
@ -517,7 +517,7 @@ namespace System.Management.Automation.Language
|
|||
throw new Exception();
|
||||
}
|
||||
|
||||
private object GetIndexedValueFromTarget(object target, object index)
|
||||
private static object GetIndexedValueFromTarget(object target, object index)
|
||||
{
|
||||
var indexArray = index as object[];
|
||||
return indexArray != null ? ((object[])indexArray).Select(i => GetSingleValueFromTarget(target, i)).ToArray() : GetSingleValueFromTarget(target, index);
|
||||
|
|
|
@ -62,12 +62,12 @@ namespace System.Management.Automation.Language
|
|||
return fnMemberAst != null ? fnMemberAst.IsStatic : ((PropertyMemberAst)currentMember).IsStatic;
|
||||
}
|
||||
|
||||
private bool IsValidAttributeArgument(Ast ast, IsConstantValueVisitor visitor)
|
||||
private static bool IsValidAttributeArgument(Ast ast, IsConstantValueVisitor visitor)
|
||||
{
|
||||
return (bool)ast.Accept(visitor);
|
||||
}
|
||||
|
||||
private (string id, string msg) GetNonConstantAttributeArgErrorExpr(IsConstantValueVisitor visitor)
|
||||
private static (string id, string msg) GetNonConstantAttributeArgErrorExpr(IsConstantValueVisitor visitor)
|
||||
{
|
||||
if (visitor.CheckingClassAttributeArguments)
|
||||
{
|
||||
|
@ -1183,7 +1183,7 @@ namespace System.Management.Automation.Language
|
|||
return AstVisitAction.Continue;
|
||||
}
|
||||
|
||||
private void CheckMemberAccess(MemberExpressionAst ast)
|
||||
private static void CheckMemberAccess(MemberExpressionAst ast)
|
||||
{
|
||||
// If the member access is not constant, it may be considered suspicious
|
||||
if (ast.Member is not ConstantExpressionAst)
|
||||
|
@ -1201,7 +1201,7 @@ namespace System.Management.Automation.Language
|
|||
}
|
||||
|
||||
// Mark all of the parents of an AST as suspicious
|
||||
private void MarkAstParentsAsSuspicious(Ast ast)
|
||||
private static void MarkAstParentsAsSuspicious(Ast ast)
|
||||
{
|
||||
Ast targetAst = ast;
|
||||
var parent = ast;
|
||||
|
|
|
@ -1699,7 +1699,7 @@ namespace System.Management.Automation
|
|||
return false;
|
||||
}
|
||||
|
||||
private void AddTypesFromMethodCacheEntry(
|
||||
private static void AddTypesFromMethodCacheEntry(
|
||||
DotNetAdapter.MethodCacheEntry methodCacheEntry,
|
||||
List<PSTypeName> result,
|
||||
bool isInvokeMemberExpressionAst)
|
||||
|
@ -2021,7 +2021,7 @@ namespace System.Management.Automation
|
|||
/// </summary>
|
||||
/// <param name="inferredTypes">The inferred types all the items in the array.</param>
|
||||
/// <returns>The inferred strongly typed array type.</returns>
|
||||
private PSTypeName GetArrayType(IEnumerable<PSTypeName> inferredTypes)
|
||||
private static PSTypeName GetArrayType(IEnumerable<PSTypeName> inferredTypes)
|
||||
{
|
||||
PSTypeName foundType = null;
|
||||
foreach (PSTypeName inferredType in inferredTypes)
|
||||
|
@ -2077,7 +2077,7 @@ namespace System.Management.Automation
|
|||
/// </summary>
|
||||
/// <param name="enumerableType">The type to infer enumerated item type from.</param>
|
||||
/// <returns>The inferred enumerated item type.</returns>
|
||||
private Type GetMostSpecificEnumeratedItemType(Type enumerableType)
|
||||
private static Type GetMostSpecificEnumeratedItemType(Type enumerableType)
|
||||
{
|
||||
if (enumerableType.IsArray)
|
||||
{
|
||||
|
@ -2153,7 +2153,7 @@ namespace System.Management.Automation
|
|||
/// The value of <paramref name="interfaceType"/> if it can be used to infer a specific
|
||||
/// enumerated type, otherwise <see langword="null"/>.
|
||||
/// </returns>
|
||||
private Type GetGenericCollectionLikeInterface(
|
||||
private static Type GetGenericCollectionLikeInterface(
|
||||
Type interfaceType,
|
||||
ref bool hasSeenNonGeneric,
|
||||
ref bool hasSeenDictionaryEnumerator)
|
||||
|
@ -2257,7 +2257,7 @@ namespace System.Management.Automation
|
|||
/// The potentially enumerable types to infer enumerated type from.
|
||||
/// </param>
|
||||
/// <returns>The enumerated item types.</returns>
|
||||
private IEnumerable<PSTypeName> GetInferredEnumeratedTypes(IEnumerable<PSTypeName> enumerableTypes)
|
||||
private static IEnumerable<PSTypeName> GetInferredEnumeratedTypes(IEnumerable<PSTypeName> enumerableTypes)
|
||||
{
|
||||
foreach (PSTypeName maybeEnumerableType in enumerableTypes)
|
||||
{
|
||||
|
|
|
@ -166,7 +166,7 @@ namespace System.Management.Automation.Internal
|
|||
Log(message, null, PipelineExecutionStatus.Error);
|
||||
}
|
||||
|
||||
private string GetCommand(InvocationInfo invocationInfo)
|
||||
private static string GetCommand(InvocationInfo invocationInfo)
|
||||
{
|
||||
if (invocationInfo == null)
|
||||
return string.Empty;
|
||||
|
@ -179,7 +179,7 @@ namespace System.Management.Automation.Internal
|
|||
return string.Empty;
|
||||
}
|
||||
|
||||
private string GetCommand(Exception exception)
|
||||
private static string GetCommand(Exception exception)
|
||||
{
|
||||
IContainsErrorRecord icer = exception as IContainsErrorRecord;
|
||||
if (icer != null && icer.ErrorRecord != null)
|
||||
|
|
|
@ -5998,7 +5998,7 @@ namespace System.Management.Automation.Language
|
|||
return string.Format(CultureInfo.InvariantCulture, "SetMember: {0}{1} ver:{2}", _static ? "static " : string.Empty, Name, _getMemberBinder._version);
|
||||
}
|
||||
|
||||
private Expression GetTransformedExpression(IEnumerable<ArgumentTransformationAttribute> transformationAttributes, Expression originalExpression)
|
||||
private static Expression GetTransformedExpression(IEnumerable<ArgumentTransformationAttribute> transformationAttributes, Expression originalExpression)
|
||||
{
|
||||
if (transformationAttributes == null)
|
||||
{
|
||||
|
@ -6286,7 +6286,7 @@ namespace System.Management.Automation.Language
|
|||
if (value.Value == null)
|
||||
{
|
||||
expr = Expression.Block(
|
||||
Expression.Assign(lhs, this.GetTransformedExpression(argumentTransformationAttributes, Expression.Constant(null, lhsType))),
|
||||
Expression.Assign(lhs, GetTransformedExpression(argumentTransformationAttributes, Expression.Constant(null, lhsType))),
|
||||
ExpressionCache.NullConstant);
|
||||
}
|
||||
else
|
||||
|
@ -6295,7 +6295,7 @@ namespace System.Management.Automation.Language
|
|||
Expression assignmentExpression;
|
||||
if (transformationNeeded)
|
||||
{
|
||||
var transformedExpr = this.GetTransformedExpression(argumentTransformationAttributes, value.Expression);
|
||||
var transformedExpr = GetTransformedExpression(argumentTransformationAttributes, value.Expression);
|
||||
assignmentExpression = DynamicExpression.Dynamic(PSConvertBinder.Get(nullableUnderlyingType), nullableUnderlyingType, transformedExpr);
|
||||
}
|
||||
else
|
||||
|
@ -6317,7 +6317,7 @@ namespace System.Management.Automation.Language
|
|||
if (transformationNeeded)
|
||||
{
|
||||
assignedValue = DynamicExpression.Dynamic(PSConvertBinder.Get(lhsType), lhsType,
|
||||
this.GetTransformedExpression(argumentTransformationAttributes, value.Expression));
|
||||
GetTransformedExpression(argumentTransformationAttributes, value.Expression));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -2955,6 +2955,10 @@ namespace System.Management.Automation
|
|||
}
|
||||
}
|
||||
|
||||
[SuppressMessage(
|
||||
"Performance",
|
||||
"CA1822:Mark members as static",
|
||||
Justification = "Accesses instance members in preprocessor branch.")]
|
||||
private bool DuplicateRefIdsAllowed
|
||||
{
|
||||
get
|
||||
|
@ -3194,7 +3198,7 @@ namespace System.Management.Automation
|
|||
internal const string CimHashCodeProperty = "Hash";
|
||||
internal const string CimMiXmlProperty = "MiXml";
|
||||
|
||||
private bool RehydrateCimInstanceProperty(
|
||||
private static bool RehydrateCimInstanceProperty(
|
||||
CimInstance cimInstance,
|
||||
PSPropertyInfo deserializedProperty,
|
||||
HashSet<string> namesOfModifiedProperties)
|
||||
|
@ -5928,7 +5932,7 @@ namespace System.Management.Automation
|
|||
|
||||
#region Plumbing to make Hashtable reject all non-primitive types
|
||||
|
||||
private string VerifyKey(object key)
|
||||
private static string VerifyKey(object key)
|
||||
{
|
||||
key = PSObject.Base(key);
|
||||
string keyAsString = key as string;
|
||||
|
@ -6028,7 +6032,7 @@ namespace System.Management.Automation
|
|||
/// </exception>
|
||||
public override void Add(object key, object value)
|
||||
{
|
||||
string keyAsString = this.VerifyKey(key);
|
||||
string keyAsString = VerifyKey(key);
|
||||
this.VerifyValue(value);
|
||||
base.Add(keyAsString, value);
|
||||
}
|
||||
|
@ -6056,7 +6060,7 @@ namespace System.Management.Automation
|
|||
|
||||
set
|
||||
{
|
||||
string keyAsString = this.VerifyKey(key);
|
||||
string keyAsString = VerifyKey(key);
|
||||
this.VerifyValue(value);
|
||||
base[keyAsString] = value;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue