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)
26
26
extent . EndColumnNumber ) ;
27
27
}
28
28
29
- public static ParameterAst [ ] GetParameterAsts (
29
+ public static IEnumerable < ParameterAst > GetParameterAsts (
30
30
this FunctionDefinitionAst functionDefinitionAst ,
31
31
out ParamBlockAst paramBlockAst )
32
32
{
33
33
paramBlockAst = null ;
34
34
if ( functionDefinitionAst . Parameters != null )
35
35
{
36
- return new List < ParameterAst > ( functionDefinitionAst . Parameters ) . ToArray ( ) ;
36
+ return functionDefinitionAst . Parameters ;
37
37
}
38
38
else if ( functionDefinitionAst . Body . ParamBlock ? . Parameters != null )
39
39
{
40
40
paramBlockAst = functionDefinitionAst . Body . ParamBlock ;
41
- return new List < ParameterAst > ( functionDefinitionAst . Body . ParamBlock . Parameters ) . ToArray ( ) ;
41
+ return functionDefinitionAst . Body . ParamBlock . Parameters ;
42
42
}
43
43
44
44
return null ;
@@ -54,7 +54,7 @@ public static AttributeAst GetCmdletBindingAttributeAst(this ParamBlockAst param
54
54
var attributeAsts = paramBlockAst . Attributes ;
55
55
if ( attributeAsts == null )
56
56
{
57
- throw new ArgumentNullException ( "attributeAsts" ) ;
57
+ return null ;
58
58
}
59
59
60
60
foreach ( var attributeAst in attributeAsts )
Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ private List<DiagnosticRecord> FindViolations()
65
65
int whatIfIndex , confirmIndex ;
66
66
ParameterAst whatIfParamAst , confirmParamAst ;
67
67
ParamBlockAst paramBlockAst ;
68
- ParameterAst [ ] parameterAsts = functionDefinitionAst . GetParameterAsts ( out paramBlockAst ) ;
68
+ var parameterAsts = functionDefinitionAst . GetParameterAsts ( out paramBlockAst ) . ToArray ( ) ;
69
69
if ( parameterAsts == null )
70
70
{
71
71
continue ;
You can’t perform that action at this time.
0 commit comments