mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-09-11 16:16:09 +03:00
Extract to function
This commit is contained in:
parent
312dff67f9
commit
1337bb97e3
@ -2303,17 +2303,17 @@ withArbitraryFilesModuleVisitor :
|
||||
-> ModuleRuleSchema { schemaState | canCollectProjectData : () } moduleContext
|
||||
-> ModuleRuleSchema { schemaState | canCollectProjectData : () } moduleContext
|
||||
withArbitraryFilesModuleVisitor newRequestedFiles newVisitor (ModuleRuleSchema schema) =
|
||||
let
|
||||
arbitraryFilesVisitor : ( List { path : String, content : String } -> moduleContext -> moduleContext, ArbitraryFileRequest )
|
||||
arbitraryFilesVisitor =
|
||||
case schema.arbitraryFilesVisitor of
|
||||
Just ( existingVisitor, existingRequestedFiles ) ->
|
||||
( combineContextOnlyVisitor newVisitor (Just existingVisitor), newRequestedFiles ++ existingRequestedFiles )
|
||||
ModuleRuleSchema { schema | arbitraryFilesVisitor = Just (combineArbitraryFilesModuleVisitor newRequestedFiles newVisitor schema) }
|
||||
|
||||
Nothing ->
|
||||
( newVisitor, newRequestedFiles )
|
||||
in
|
||||
ModuleRuleSchema { schema | arbitraryFilesVisitor = Just arbitraryFilesVisitor }
|
||||
|
||||
combineArbitraryFilesModuleVisitor : ArbitraryFileRequest -> (a -> context -> context) -> { b | arbitraryFilesVisitor : Maybe ( a -> context -> context, ArbitraryFileRequest ) } -> ( a -> context -> context, ArbitraryFileRequest )
|
||||
combineArbitraryFilesModuleVisitor newRequestedFiles newVisitor schema =
|
||||
case schema.arbitraryFilesVisitor of
|
||||
Just ( existingVisitor, existingRequestedFiles ) ->
|
||||
( combineContextOnlyVisitor newVisitor (Just existingVisitor), newRequestedFiles ++ existingRequestedFiles )
|
||||
|
||||
Nothing ->
|
||||
( newVisitor, newRequestedFiles )
|
||||
|
||||
|
||||
{-| Add a visitor to the [`ModuleRuleSchema`](#ModuleRuleSchema) which will visit
|
||||
|
Loading…
Reference in New Issue
Block a user