Thanks to visit codestin.com
Credit goes to github.com

Skip to content

IDictionary -> IDictionary<string, FunctionInfo> for FunctionTable#12658

Merged
3 commits merged intoPowerShell:masterfrom
powercode:Nullable/FunctionTable
May 20, 2020
Merged

IDictionary -> IDictionary<string, FunctionInfo> for FunctionTable#12658
3 commits merged intoPowerShell:masterfrom
powercode:Nullable/FunctionTable

Conversation

@powercode
Copy link
Collaborator

@powercode powercode commented May 14, 2020

PR Summary

Typed return value for SessionStateInternal.GetFunctionTable.
IDictionary<string, FunctionInfo> instead of IDictionary.

PR Context

Removes unnecessary casts, and helps with later nullablility changes.

PR Checklist

@powercode powercode requested a review from anmenaga as a code owner May 14, 2020 07:19
@ghost ghost assigned daxian-dbw May 14, 2020
@powercode powercode force-pushed the Nullable/FunctionTable branch from f63aa7f to 6667d89 Compare May 14, 2020 07:21
Copy link
Collaborator

@vexx32 vexx32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 🙂

WildcardOptions.IgnoreCase);

foreach (DictionaryEntry functionEntry in _context.EngineSessionState.GetFunctionTable())
foreach (var functionEntry in _context.EngineSessionState.GetFunctionTable())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type is not obvious. Please replace var with explicit type.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe

ExecutionContext context = _context;
SessionStateInternal sessionState = context.EngineSessionState;
IDictionary<string, FunctionInfo> functionTable = sessionState.GetFunctionTable();
foreach (KeyValuePair<string, FunctionInfo> functionEntry in functionTable)
{
...

The types are not obvious in _context.EngineSessionState.GetFunctionTable() either...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_context.EngineSessionState is common pattern in Engine. .For the small refactor I thing it makes sense only replace var with type.

@powercode
Copy link
Collaborator Author

Codacy is just wrong here, by the way.

@iSazonov iSazonov added the CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log label May 20, 2020
@iSazonov iSazonov added this to the 7.1.0-preview.4 milestone May 20, 2020
@iSazonov iSazonov added the AutoMerge informs the bot to automerge the PR label May 20, 2020
@ghost
Copy link

ghost commented May 20, 2020

Hello @iSazonov!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 9fe96f0 into PowerShell:master May 20, 2020
@powercode powercode deleted the Nullable/FunctionTable branch May 20, 2020 06:19
@ghost
Copy link

ghost commented Jun 25, 2020

🎉v7.1.0-preview.4 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AutoMerge informs the bot to automerge the PR CL-CodeCleanup Indicates that a PR should be marked as a Code Cleanup change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants