File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,5 +24,23 @@ public static Range ToRange(this IScriptExtent extent)
2424 extent . EndLineNumber ,
2525 extent . EndColumnNumber ) ;
2626 }
27+
28+ public static ParameterAst [ ] GetParameterAsts (
29+ this FunctionDefinitionAst functionDefinitionAst ,
30+ out ParamBlockAst paramBlockAst )
31+ {
32+ paramBlockAst = null ;
33+ if ( functionDefinitionAst . Parameters != null )
34+ {
35+ return new List < ParameterAst > ( functionDefinitionAst . Parameters ) . ToArray ( ) ;
36+ }
37+ else if ( functionDefinitionAst . Body . ParamBlock ? . Parameters != null )
38+ {
39+ paramBlockAst = functionDefinitionAst . Body . ParamBlock ;
40+ return new List < ParameterAst > ( functionDefinitionAst . Body . ParamBlock . Parameters ) . ToArray ( ) ;
41+ }
42+
43+ return null ;
44+ }
2745 }
2846}
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 = GetParameters ( functionDefinitionAst , out paramBlockAst ) ;
68+ ParameterAst [ ] parameterAsts = functionDefinitionAst . GetParameterAsts ( out paramBlockAst ) ;
6969 if ( parameterAsts == null )
7070 {
7171 continue ;
@@ -110,24 +110,6 @@ private List<DiagnosticRecord> FindViolations()
110110 return diagnosticRecords ;
111111 }
112112
113- private static ParameterAst [ ] GetParameters (
114- FunctionDefinitionAst functionDefinitionAst ,
115- out ParamBlockAst paramBlockAst )
116- {
117- paramBlockAst = null ;
118- if ( functionDefinitionAst . Parameters != null )
119- {
120- return new List < ParameterAst > ( functionDefinitionAst . Parameters ) . ToArray ( ) ;
121- }
122- else if ( functionDefinitionAst . Body . ParamBlock ? . Parameters != null )
123- {
124- paramBlockAst = functionDefinitionAst . Body . ParamBlock ;
125- return new List < ParameterAst > ( functionDefinitionAst . Body . ParamBlock . Parameters ) . ToArray ( ) ;
126- }
127-
128- return null ;
129- }
130-
131113 private List < CorrectionExtent > GetCorrections (
132114 int whatIfIndex ,
133115 int confirmIndex ,
You can’t perform that action at this time.
0 commit comments