Rename fold to foldGlobalContexts

This commit is contained in:
Jeroen Engels 2020-01-12 22:49:23 +01:00
parent 4ae4895ba2
commit 009613ec61
3 changed files with 13 additions and 13 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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 })
]