@@ -28,8 +28,6 @@ public class Helper
2828
2929 private readonly CommandInvocationIntrinsics _invokeCommand ;
3030
31- private readonly IOutputWriter _outputWriter ;
32-
3331 private Dictionary < string , Dictionary < string , object > > _ruleArguments ;
3432
3533 private PSVersionTable _psVersionTable ;
@@ -125,16 +123,15 @@ private Helper()
125123 /// A CommandInvocationIntrinsics instance for use in gathering
126124 /// information about available commands and aliases.
127125 /// </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 )
135127 {
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 > ( ) ;
138135 }
139136
140137 #region Methods
@@ -143,20 +140,13 @@ public Helper(
143140 /// </summary>
144141 public void Initialize ( )
145142 {
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 ) ;
154144
155145 foreach ( AliasInfo aliasInfo in aliases )
156146 {
157147 if ( ! CmdletToAliasDictionary . ContainsKey ( aliasInfo . Definition ) )
158148 {
159- CmdletToAliasDictionary . Add ( aliasInfo . Definition , new List < String > ( ) { aliasInfo . Name } ) ;
149+ CmdletToAliasDictionary . Add ( aliasInfo . Definition , new List < string > ( ) { aliasInfo . Name } ) ;
160150 }
161151 else
162152 {
@@ -1600,7 +1590,7 @@ public NamedAttributeArgumentAst GetShouldProcessAttributeAst(IEnumerable<Attrib
16001590 {
16011591 throw new ArgumentNullException ( "attributeAsts" ) ;
16021592 }
1603- var cmdletBindingAttributeAst = this . GetCmdletBindingAttributeAst ( attributeAsts ) ;
1593+ var cmdletBindingAttributeAst = GetCmdletBindingAttributeAst ( attributeAsts ) ;
16041594 if ( cmdletBindingAttributeAst == null
16051595 || cmdletBindingAttributeAst . NamedArguments == null )
16061596 {
@@ -1883,7 +1873,7 @@ public void SetPSVersionTable(Hashtable psVersionTable)
18831873 throw new ArgumentNullException ( "psVersionTable" ) ;
18841874 }
18851875
1886- this . _psVersionTable = new PSVersionTable ( psVersionTable ) ;
1876+ _psVersionTable = new PSVersionTable ( psVersionTable ) ;
18871877 }
18881878
18891879#if CORECLR
@@ -1892,7 +1882,7 @@ public SemanticVersion GetPSVersion()
18921882 public Version GetPSVersion ( )
18931883#endif
18941884 {
1895- return _psVersionTable == null ? null : _psVersionTable . PSVersion ;
1885+ return _psVersionTable ? . PSVersion ;
18961886 }
18971887
18981888#endregion Methods
0 commit comments