-
Notifications
You must be signed in to change notification settings - Fork 8.1k
fix(engine): nullable #13801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
georgettica
wants to merge
1
commit into
PowerShell:master
from
georgettica:georgettica/engine-nullable
Closed
fix(engine): nullable #13801
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -539,7 +539,7 @@ private Dictionary<MergedCompiledCommandParameter, object> GetQualifiedParameter | |
| } | ||
| } | ||
|
|
||
| result.Add(param, pair.Value); | ||
| result.Add(param, pair); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is not nullable. |
||
| } | ||
|
|
||
| if (result.Count > 0) | ||
|
|
@@ -640,7 +640,7 @@ private Dictionary<MergedCompiledCommandParameter, object> GetDefaultParameterVa | |
| if (!DefaultParameterDictionary.CheckKeyIsValid(key, ref cmdletName, ref parameterName)) | ||
| { | ||
| if (key.Equals("Disabled", StringComparison.OrdinalIgnoreCase) && | ||
| LanguagePrimitives.IsTrue(entry.Value)) | ||
| LanguagePrimitives.IsTrue(entry)) | ||
| { | ||
| _useDefaultParameterBinding = false; | ||
| return null; | ||
|
|
@@ -658,7 +658,7 @@ private Dictionary<MergedCompiledCommandParameter, object> GetDefaultParameterVa | |
|
|
||
| if (WildcardPattern.ContainsWildcardCharacters(key)) | ||
| { | ||
| wildcardDefault.Add(cmdletName + Separator + parameterName, entry.Value); | ||
| wildcardDefault.Add(cmdletName + Separator + parameterName, entry); | ||
| continue; | ||
| } | ||
|
|
||
|
|
@@ -670,7 +670,7 @@ private Dictionary<MergedCompiledCommandParameter, object> GetDefaultParameterVa | |
| } | ||
|
|
||
| GetDefaultParameterValuePairsHelper( | ||
| cmdletName, parameterName, entry.Value, | ||
| cmdletName, parameterName, entry, | ||
| bindableParameters, bindableAlias, | ||
| availablePairs, parametersToRemove); | ||
| } | ||
|
|
@@ -693,7 +693,7 @@ private Dictionary<MergedCompiledCommandParameter, object> GetDefaultParameterVa | |
| if (!WildcardPattern.ContainsWildcardCharacters(parameterName)) | ||
| { | ||
| GetDefaultParameterValuePairsHelper( | ||
| cmdletName, parameterName, wildcard.Value, | ||
| cmdletName, parameterName, wildcard, | ||
| bindableParameters, bindableAlias, | ||
| availablePairs, parametersToRemove); | ||
|
|
||
|
|
@@ -707,15 +707,15 @@ private Dictionary<MergedCompiledCommandParameter, object> GetDefaultParameterVa | |
| { | ||
| if (parameterPattern.IsMatch(entry.Key)) | ||
| { | ||
| matches.Add(entry.Value); | ||
| matches.Add(entry); | ||
| } | ||
| } | ||
|
|
||
| foreach (KeyValuePair<string, MergedCompiledCommandParameter> entry in bindableAlias) | ||
| { | ||
| if (parameterPattern.IsMatch(entry.Key)) | ||
| { | ||
| matches.Add(entry.Value); | ||
| matches.Add(entry); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -736,11 +736,11 @@ private Dictionary<MergedCompiledCommandParameter, object> GetDefaultParameterVa | |
| { | ||
| if (!availablePairs.ContainsKey(matches[0])) | ||
| { | ||
| availablePairs.Add(matches[0], wildcard.Value); | ||
| availablePairs.Add(matches[0], wildcard); | ||
| continue; | ||
| } | ||
|
|
||
| if (!wildcard.Value.Equals(availablePairs[matches[0]])) | ||
| if (!wildcard.Equals(availablePairs[matches[0]])) | ||
| { | ||
| if (!_warningSet.Contains(cmdletName + Separator + parameterName)) | ||
| { | ||
|
|
@@ -869,7 +869,7 @@ private void VerifyArgumentsProcessed(ParameterBindingException originalBindingE | |
|
|
||
| Type specifiedType = null; | ||
| object argumentValue = parameter.ArgumentValue; | ||
| if (argumentValue != null && argumentValue != UnboundParameter.Value) | ||
| if (argumentValue != null && argumentValue != UnboundParameter) | ||
| { | ||
| specifiedType = argumentValue.GetType(); | ||
| } | ||
|
|
@@ -1540,7 +1540,7 @@ private void HandleRemainingArguments() | |
| if (argument.ArgumentSpecified) | ||
| { | ||
| object argumentValue = argument.ArgumentValue; | ||
| if (argumentValue != AutomationNull.Value && argumentValue != UnboundParameter.Value) | ||
| if (argumentValue != AutomationNull && argumentValue != UnboundParameter) | ||
| { | ||
| valueFromRemainingArguments.Add(argumentValue); | ||
| } | ||
|
|
@@ -2883,7 +2883,7 @@ internal bool HandleUnboundMandatoryParameters( | |
| var argument = | ||
| CommandParameterInternal.CreateParameterWithArgument( | ||
| /*parameterAst*/null, entry.Key, "-" + entry.Key + ":", | ||
| /*argumentAst*/null, entry.Value, | ||
| /*argumentAst*/null, entry, | ||
| false); | ||
|
|
||
| // Ignore the result since any failure should cause an exception | ||
|
|
@@ -3265,7 +3265,7 @@ private bool BindPipelineParametersPrivate(PSObject inputToOperateOn) | |
| ConsolidatedString dontuseInternalTypeNames; | ||
| ParameterBinderBase.bindingTracer.WriteLine( | ||
| "PIPELINE object TYPE = [{0}]", | ||
| inputToOperateOn == null || inputToOperateOn == AutomationNull.Value | ||
| inputToOperateOn == null || inputToOperateOn == AutomationNull | ||
| ? "null" | ||
| : ((dontuseInternalTypeNames = inputToOperateOn.InternalTypeNames).Count > 0 && dontuseInternalTypeNames[0] != null) | ||
| ? dontuseInternalTypeNames[0] | ||
|
|
@@ -3589,7 +3589,7 @@ private bool BindValueFromPipelineByPropertyName( | |
| { | ||
| bindResult = | ||
| BindPipelineParameter( | ||
| member.Value, | ||
| member, | ||
| parameter, | ||
| flags); | ||
| } | ||
|
|
@@ -3678,7 +3678,7 @@ private bool InvokeAndBindDelayBindScriptBlock(PSObject inputToOperateOn, out bo | |
| { | ||
| thereWasSomethingToBind = true; | ||
|
|
||
| CommandParameterInternal argument = delayedScriptBlock.Value._argument; | ||
| CommandParameterInternal argument = delayedScriptBlock._argument; | ||
| MergedCompiledCommandParameter parameter = delayedScriptBlock.Key; | ||
|
|
||
| ScriptBlock script = argument.ArgumentValue as ScriptBlock; | ||
|
|
@@ -3693,12 +3693,12 @@ private bool InvokeAndBindDelayBindScriptBlock(PSObject inputToOperateOn, out bo | |
| using (ParameterBinderBase.bindingTracer.TraceScope( | ||
| "Invoking delay-bind ScriptBlock")) | ||
| { | ||
| if (delayedScriptBlock.Value._parameterBinder == this) | ||
| if (delayedScriptBlock._parameterBinder == this) | ||
| { | ||
| try | ||
| { | ||
| output = script.DoInvoke(inputToOperateOn, inputToOperateOn, Array.Empty<object>()); | ||
| delayedScriptBlock.Value._evaluatedArgument = output; | ||
| delayedScriptBlock._evaluatedArgument = output; | ||
| } | ||
| catch (RuntimeException runtimeException) | ||
| { | ||
|
|
@@ -3707,7 +3707,7 @@ private bool InvokeAndBindDelayBindScriptBlock(PSObject inputToOperateOn, out bo | |
| } | ||
| else | ||
| { | ||
| output = delayedScriptBlock.Value._evaluatedArgument; | ||
| output = delayedScriptBlock._evaluatedArgument; | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -4105,7 +4105,7 @@ private bool BindPipelineParameter( | |
| { | ||
| bool result = false; | ||
|
|
||
| if (parameterValue != AutomationNull.Value) | ||
| if (parameterValue != AutomationNull) | ||
| { | ||
| s_tracer.WriteLine("Adding PipelineParameter name={0}; value={1}", | ||
| parameter.Parameter.Name, parameterValue ?? "null"); | ||
|
|
@@ -4344,7 +4344,7 @@ public DefaultParameterDictionary(IDictionary dictionary) | |
| Diagnostics.Assert(isSpecialKey || (cmdletName != null && parameterName != null), "The cmdletName and parameterName should be set in CheckKeyIsValid"); | ||
| if (keysInBadFormat.Count == 0 && !base.ContainsKey(key)) | ||
| { | ||
| base.Add(key, entry.Value); | ||
| base.Add(key, entry); | ||
| } | ||
| } | ||
| else | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not correct. See my comment in another PR.