mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-11-23 23:05:35 +03:00
Rename fold to foldGlobalContexts
This commit is contained in:
parent
4ae4895ba2
commit
009613ec61
@ -59,7 +59,7 @@ rule =
|
||||
, initGlobalContext = initGlobalContext
|
||||
, fromGlobalToModule = fromGlobalToModule
|
||||
, fromModuleToGlobal = fromModuleToGlobal
|
||||
, fold = fold
|
||||
, foldGlobalContexts = foldGlobalContexts
|
||||
}
|
||||
|> Rule.traversingImportedModulesFirst
|
||||
|> Rule.withMultiFinalEvaluation finalEvaluationForProject
|
||||
@ -115,8 +115,8 @@ fromModuleToGlobal fileKey moduleName moduleContext =
|
||||
}
|
||||
|
||||
|
||||
fold : GlobalContext -> GlobalContext -> GlobalContext
|
||||
fold contextA contextB =
|
||||
foldGlobalContexts : GlobalContext -> GlobalContext -> GlobalContext
|
||||
foldGlobalContexts contextA contextB =
|
||||
{ modules = Dict.union contextA.modules contextB.modules
|
||||
}
|
||||
|
||||
|
@ -52,7 +52,7 @@ rule =
|
||||
, initGlobalContext = initGlobalContext
|
||||
, fromGlobalToModule = fromGlobalToModule
|
||||
, fromModuleToGlobal = fromModuleToGlobal
|
||||
, fold = fold
|
||||
, foldGlobalContexts = foldGlobalContexts
|
||||
}
|
||||
|> Rule.withMultiElmJsonVisitor elmJsonVisitor
|
||||
|> Rule.withMultiFinalEvaluation finalEvaluationForProject
|
||||
@ -113,8 +113,8 @@ fromModuleToGlobal fileKey moduleName moduleContext =
|
||||
}
|
||||
|
||||
|
||||
fold : GlobalContext -> GlobalContext -> GlobalContext
|
||||
fold contextA contextB =
|
||||
foldGlobalContexts : GlobalContext -> GlobalContext -> GlobalContext
|
||||
foldGlobalContexts contextA contextB =
|
||||
{ modules = Dict.union contextA.modules contextB.modules
|
||||
, usedModules = Set.union contextA.usedModules contextB.usedModules
|
||||
, isPackage = contextA.isPackage
|
||||
|
@ -551,7 +551,7 @@ type MultiSchema globalContext moduleContext
|
||||
{ initGlobalContext : globalContext
|
||||
, fromGlobalToModule : FileKey -> Node ModuleName -> globalContext -> moduleContext
|
||||
, fromModuleToGlobal : FileKey -> Node ModuleName -> moduleContext -> globalContext
|
||||
, fold : globalContext -> globalContext -> globalContext
|
||||
, foldGlobalContexts : globalContext -> globalContext -> globalContext
|
||||
}
|
||||
, moduleVisitorSchema : Schema ForLookingAtSeveralFiles { hasNoVisitor : () } moduleContext -> Schema ForLookingAtSeveralFiles { hasAtLeastOneVisitor : () } moduleContext
|
||||
, elmJsonVisitors : List (Maybe Elm.Project.Project -> globalContext -> globalContext)
|
||||
@ -573,17 +573,17 @@ newMultiSchema :
|
||||
, initGlobalContext : globalContext
|
||||
, fromGlobalToModule : FileKey -> Node ModuleName -> globalContext -> moduleContext
|
||||
, fromModuleToGlobal : FileKey -> Node ModuleName -> moduleContext -> globalContext
|
||||
, fold : globalContext -> globalContext -> globalContext
|
||||
, foldGlobalContexts : globalContext -> globalContext -> globalContext
|
||||
}
|
||||
-> MultiSchema globalContext moduleContext
|
||||
newMultiSchema name_ { moduleVisitorSchema, initGlobalContext, fromGlobalToModule, fromModuleToGlobal, fold } =
|
||||
newMultiSchema name_ { moduleVisitorSchema, initGlobalContext, fromGlobalToModule, fromModuleToGlobal, foldGlobalContexts } =
|
||||
MultiSchema
|
||||
{ name = name_
|
||||
, context =
|
||||
{ initGlobalContext = initGlobalContext
|
||||
, fromGlobalToModule = fromGlobalToModule
|
||||
, fromModuleToGlobal = fromModuleToGlobal
|
||||
, fold = fold
|
||||
, foldGlobalContexts = foldGlobalContexts
|
||||
}
|
||||
, moduleVisitorSchema = moduleVisitorSchema
|
||||
, elmJsonVisitors = []
|
||||
@ -728,7 +728,7 @@ allFilesInParallelTraversal (MultiSchema schema) startCache project =
|
||||
[ List.concatMap Tuple.first contextsAndErrorsPerFile
|
||||
, contextsAndErrorsPerFile
|
||||
|> List.map Tuple.second
|
||||
|> List.foldl schema.context.fold initialContext
|
||||
|> List.foldl schema.context.foldGlobalContexts initialContext
|
||||
|> makeFinalEvaluationForMulti schema.finalEvaluationFns
|
||||
|> List.map (\(Error err) -> Error { err | ruleName = schema.name })
|
||||
]
|
||||
@ -789,7 +789,7 @@ importedModulesFirst (MultiSchema schema) startCache project =
|
||||
|> Maybe.map .context
|
||||
)
|
||||
-- TODO Remove contexts from parents already handled by other parents
|
||||
|> List.foldl schema.context.fold initialContext
|
||||
|> List.foldl schema.context.foldGlobalContexts initialContext
|
||||
|> schema.context.fromGlobalToModule fileKey moduleNameNode_
|
||||
|
||||
moduleVisitor : Schema ForLookingAtSeveralFiles { hasAtLeastOneVisitor : () } moduleContext
|
||||
@ -856,7 +856,7 @@ importedModulesFirst (MultiSchema schema) startCache project =
|
||||
[ List.concatMap Tuple.first contextsAndErrorsPerFile
|
||||
, contextsAndErrorsPerFile
|
||||
|> List.map Tuple.second
|
||||
|> List.foldl schema.context.fold initialContext
|
||||
|> List.foldl schema.context.foldGlobalContexts initialContext
|
||||
|> makeFinalEvaluationForMulti schema.finalEvaluationFns
|
||||
|> List.map (\(Error err) -> Error { err | ruleName = schema.name })
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user