Skip to content

Commit 97e64a0

Browse files
NamingHelpers: refactoring (#563)
Minor refactoring of getPatternIdents function: added function comment; renamed local variable
1 parent 76d6e9d commit 97e64a0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/FSharpLint.Core/Rules/Conventions/Naming/NamingHelper.fs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,12 @@ let isImplicitModule (SynModuleOrNamespace.SynModuleOrNamespace(longIdent, _, mo
304304

305305
type GetIdents<'t> = Accessibility -> SynPat -> 't []
306306

307-
let rec getPatternIdents<'t> accessibility (getIdents:GetIdents<'t>) argsAreParameters pattern =
307+
/// Recursively get all identifiers from pattern using provided getIdents function and collect them into array.
308+
/// accessibility parameter is passed to getIdents, and can be narrowed down along the way (see checkAccessibility).
309+
let rec getPatternIdents<'t> (accessibility:Accessibility) (getIdents:GetIdents<'t>) argsAreParameters (pattern:SynPat) =
308310
match pattern with
309311
| SynPat.LongIdent(_, _, _, args, access, _) ->
310-
let isPublic = checkAccessibility accessibility access
312+
let identAccessibility = checkAccessibility accessibility access
311313

312314
let hasNoArgs =
313315
match args with
@@ -327,7 +329,7 @@ let rec getPatternIdents<'t> accessibility (getIdents:GetIdents<'t>) argsArePara
327329

328330
// Only check if expecting args as parameters e.g. function - otherwise is a DU pattern.
329331
if hasNoArgs || argsAreParameters then
330-
getIdents isPublic pattern
332+
getIdents identAccessibility pattern
331333
|> Array.append argSuggestions
332334
else
333335
argSuggestions

0 commit comments

Comments
 (0)