@@ -28,8 +28,6 @@ public class Helper
28
28
29
29
private readonly CommandInvocationIntrinsics _invokeCommand ;
30
30
31
- private readonly IOutputWriter _outputWriter ;
32
-
33
31
private Dictionary < string , Dictionary < string , object > > _ruleArguments ;
34
32
35
33
private PSVersionTable _psVersionTable ;
@@ -125,16 +123,15 @@ private Helper()
125
123
/// A CommandInvocationIntrinsics instance for use in gathering
126
124
/// information about available commands and aliases.
127
125
/// </param>
128
- /// <param name="outputWriter">
129
- /// An IOutputWriter instance for use in writing output
130
- /// to the PowerShell environment.
131
- /// </param>
132
- public Helper (
133
- CommandInvocationIntrinsics invokeCommand ,
134
- IOutputWriter outputWriter )
126
+ public Helper ( CommandInvocationIntrinsics invokeCommand )
135
127
{
136
- this . _invokeCommand = invokeCommand ;
137
- this . _outputWriter = outputWriter ;
128
+ _invokeCommand = invokeCommand ;
129
+ _ruleArguments = new Dictionary < string , Dictionary < string , object > > ( StringComparer . OrdinalIgnoreCase ) ;
130
+ _commandInfoCache = new Lazy < CommandInfoCache > ( ( ) => new CommandInfoCache ( ) ) ;
131
+ CmdletToAliasDictionary = new Dictionary < string , List < string > > ( StringComparer . OrdinalIgnoreCase ) ;
132
+ AliasToCmdletDictionary = new Dictionary < string , string > ( StringComparer . OrdinalIgnoreCase ) ;
133
+ KeywordBlockDictionary = new Dictionary < string , List < Tuple < int , int > > > ( StringComparer . OrdinalIgnoreCase ) ;
134
+ VariableAnalysisDictionary = new Dictionary < Ast , VariableAnalysis > ( ) ;
138
135
}
139
136
140
137
#region Methods
@@ -143,20 +140,13 @@ public Helper(
143
140
/// </summary>
144
141
public void Initialize ( )
145
142
{
146
- CmdletToAliasDictionary = new Dictionary < String , List < String > > ( StringComparer . OrdinalIgnoreCase ) ;
147
- AliasToCmdletDictionary = new Dictionary < String , String > ( StringComparer . OrdinalIgnoreCase ) ;
148
- KeywordBlockDictionary = new Dictionary < String , List < Tuple < int , int > > > ( StringComparer . OrdinalIgnoreCase ) ;
149
- VariableAnalysisDictionary = new Dictionary < Ast , VariableAnalysis > ( ) ;
150
- _ruleArguments = new Dictionary < string , Dictionary < string , object > > ( StringComparer . OrdinalIgnoreCase ) ;
151
- _commandInfoCache = new Lazy < CommandInfoCache > ( ( ) => new CommandInfoCache ( ) ) ;
152
-
153
- IEnumerable < CommandInfo > aliases = this . _invokeCommand . GetCommands ( "*" , CommandTypes . Alias , true ) ;
143
+ IEnumerable < CommandInfo > aliases = _invokeCommand . GetCommands ( "*" , CommandTypes . Alias , nameIsPattern : true ) ;
154
144
155
145
foreach ( AliasInfo aliasInfo in aliases )
156
146
{
157
147
if ( ! CmdletToAliasDictionary . ContainsKey ( aliasInfo . Definition ) )
158
148
{
159
- CmdletToAliasDictionary . Add ( aliasInfo . Definition , new List < String > ( ) { aliasInfo . Name } ) ;
149
+ CmdletToAliasDictionary . Add ( aliasInfo . Definition , new List < string > ( ) { aliasInfo . Name } ) ;
160
150
}
161
151
else
162
152
{
@@ -1600,7 +1590,7 @@ public NamedAttributeArgumentAst GetShouldProcessAttributeAst(IEnumerable<Attrib
1600
1590
{
1601
1591
throw new ArgumentNullException ( "attributeAsts" ) ;
1602
1592
}
1603
- var cmdletBindingAttributeAst = this . GetCmdletBindingAttributeAst ( attributeAsts ) ;
1593
+ var cmdletBindingAttributeAst = GetCmdletBindingAttributeAst ( attributeAsts ) ;
1604
1594
if ( cmdletBindingAttributeAst == null
1605
1595
|| cmdletBindingAttributeAst . NamedArguments == null )
1606
1596
{
@@ -1883,7 +1873,7 @@ public void SetPSVersionTable(Hashtable psVersionTable)
1883
1873
throw new ArgumentNullException ( "psVersionTable" ) ;
1884
1874
}
1885
1875
1886
- this . _psVersionTable = new PSVersionTable ( psVersionTable ) ;
1876
+ _psVersionTable = new PSVersionTable ( psVersionTable ) ;
1887
1877
}
1888
1878
1889
1879
#if CORECLR
@@ -1892,7 +1882,7 @@ public SemanticVersion GetPSVersion()
1892
1882
public Version GetPSVersion ( )
1893
1883
#endif
1894
1884
{
1895
- return _psVersionTable == null ? null : _psVersionTable . PSVersion ;
1885
+ return _psVersionTable ? . PSVersion ;
1896
1886
}
1897
1887
1898
1888
#endregion Methods
0 commit comments