File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -26,19 +26,19 @@ public static Range ToRange(this IScriptExtent extent)
2626 extent . EndColumnNumber ) ;
2727 }
2828
29- public static ParameterAst [ ] GetParameterAsts (
29+ public static IEnumerable < ParameterAst > GetParameterAsts (
3030 this FunctionDefinitionAst functionDefinitionAst ,
3131 out ParamBlockAst paramBlockAst )
3232 {
3333 paramBlockAst = null ;
3434 if ( functionDefinitionAst . Parameters != null )
3535 {
36- return new List < ParameterAst > ( functionDefinitionAst . Parameters ) . ToArray ( ) ;
36+ return functionDefinitionAst . Parameters ;
3737 }
3838 else if ( functionDefinitionAst . Body . ParamBlock ? . Parameters != null )
3939 {
4040 paramBlockAst = functionDefinitionAst . Body . ParamBlock ;
41- return new List < ParameterAst > ( functionDefinitionAst . Body . ParamBlock . Parameters ) . ToArray ( ) ;
41+ return functionDefinitionAst . Body . ParamBlock . Parameters ;
4242 }
4343
4444 return null ;
@@ -54,7 +54,7 @@ public static AttributeAst GetCmdletBindingAttributeAst(this ParamBlockAst param
5454 var attributeAsts = paramBlockAst . Attributes ;
5555 if ( attributeAsts == null )
5656 {
57- throw new ArgumentNullException ( "attributeAsts" ) ;
57+ return null ;
5858 }
5959
6060 foreach ( var attributeAst in attributeAsts )
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ private List<DiagnosticRecord> FindViolations()
6565 int whatIfIndex , confirmIndex ;
6666 ParameterAst whatIfParamAst , confirmParamAst ;
6767 ParamBlockAst paramBlockAst ;
68- ParameterAst [ ] parameterAsts = functionDefinitionAst . GetParameterAsts ( out paramBlockAst ) ;
68+ var parameterAsts = functionDefinitionAst . GetParameterAsts ( out paramBlockAst ) . ToArray ( ) ;
6969 if ( parameterAsts == null )
7070 {
7171 continue ;
You can’t perform that action at this time.
0 commit comments