mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Requires.NotNull-->ArgumentNullException.ThrowIfNull (#18820)
This commit is contained in:
+1
-1
@@ -142,7 +142,7 @@ namespace System.Management.Automation.Subsystem.Prediction
|
||||
/// <param name="history">History command lines provided as references for prediction.</param>
|
||||
public static void OnCommandLineAccepted(PredictionClient client, IReadOnlyList<string> history)
|
||||
{
|
||||
Requires.NotNull(history, nameof(history));
|
||||
ArgumentNullException.ThrowIfNull(history);
|
||||
|
||||
var predictors = SubsystemManager.GetSubsystems<ICommandPredictor>();
|
||||
if (predictors.Count == 0)
|
||||
|
||||
+2
-2
@@ -181,8 +181,8 @@ namespace System.Management.Automation.Subsystem.Prediction
|
||||
/// <param name="inputTokens">The <see cref="Token"/> objects from parsing the current command line input.</param>
|
||||
public PredictionContext(Ast inputAst, Token[] inputTokens)
|
||||
{
|
||||
Requires.NotNull(inputAst, nameof(inputAst));
|
||||
Requires.NotNull(inputTokens, nameof(inputTokens));
|
||||
ArgumentNullException.ThrowIfNull(inputAst);
|
||||
ArgumentNullException.ThrowIfNull(inputTokens);
|
||||
|
||||
var cursor = inputAst.Extent.EndScriptPosition;
|
||||
var astContext = CompletionAnalysis.ExtractAstContext(inputAst, inputTokens, cursor);
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace System.Management.Automation.Subsystem
|
||||
/// <returns>The <see cref="SubsystemInfo"/> object that represents the concrete subsystem.</returns>
|
||||
public static SubsystemInfo GetSubsystemInfo(Type subsystemType)
|
||||
{
|
||||
Requires.NotNull(subsystemType, nameof(subsystemType));
|
||||
ArgumentNullException.ThrowIfNull(subsystemType);
|
||||
|
||||
if (s_subSystemTypeMap.TryGetValue(subsystemType, out SubsystemInfo? subsystemInfo))
|
||||
{
|
||||
@@ -180,7 +180,7 @@ namespace System.Management.Automation.Subsystem
|
||||
where TConcreteSubsystem : class, ISubsystem
|
||||
where TImplementation : class, TConcreteSubsystem
|
||||
{
|
||||
Requires.NotNull(proxy, nameof(proxy));
|
||||
ArgumentNullException.ThrowIfNull(proxy);
|
||||
|
||||
RegisterSubsystem(GetSubsystemInfo(typeof(TConcreteSubsystem)), proxy);
|
||||
}
|
||||
@@ -192,7 +192,7 @@ namespace System.Management.Automation.Subsystem
|
||||
/// <param name="proxy">An instance of the implementation.</param>
|
||||
public static void RegisterSubsystem(SubsystemKind kind, ISubsystem proxy)
|
||||
{
|
||||
Requires.NotNull(proxy, nameof(proxy));
|
||||
ArgumentNullException.ThrowIfNull(proxy);
|
||||
|
||||
SubsystemInfo info = GetSubsystemInfo(kind);
|
||||
if (!info.SubsystemType.IsAssignableFrom(proxy.GetType()))
|
||||
|
||||
Reference in New Issue
Block a user