Rename initModuleContext to fromGlobalToModule

This commit is contained in:
Jeroen Engels 2020-01-12 22:46:29 +01:00
parent 13d845db25
commit 4ae4895ba2
3 changed files with 12 additions and 12 deletions

View File

@ -57,7 +57,7 @@ rule =
schema
|> Rule.withModuleDefinitionVisitor moduleDefinitionVisitor
, initGlobalContext = initGlobalContext
, initModuleContext = initModuleContext
, fromGlobalToModule = fromGlobalToModule
, fromModuleToGlobal = fromModuleToGlobal
, fold = fold
}
@ -97,8 +97,8 @@ initGlobalContext =
}
initModuleContext : Rule.FileKey -> Node ModuleName -> GlobalContext -> ModuleContext
initModuleContext fileKey moduleNameNode globalContext =
fromGlobalToModule : Rule.FileKey -> Node ModuleName -> GlobalContext -> ModuleContext
fromGlobalToModule fileKey moduleNameNode globalContext =
{ exposesEverything = False
, exposed = Dict.empty
}

View File

@ -50,7 +50,7 @@ rule =
Rule.newMultiSchema "NoUnused.Modules"
{ moduleVisitorSchema = moduleVisitorSchema
, initGlobalContext = initGlobalContext
, initModuleContext = initModuleContext
, fromGlobalToModule = fromGlobalToModule
, fromModuleToGlobal = fromModuleToGlobal
, fold = fold
}
@ -89,8 +89,8 @@ initGlobalContext =
}
initModuleContext : Rule.FileKey -> Node ModuleName -> GlobalContext -> ModuleContext
initModuleContext _ _ globalContext =
fromGlobalToModule : Rule.FileKey -> Node ModuleName -> GlobalContext -> ModuleContext
fromGlobalToModule _ _ globalContext =
{ importedModules = Set.empty
, containsMainFunction = False
, isPackage = globalContext.isPackage

View File

@ -549,7 +549,7 @@ type MultiSchema globalContext moduleContext
{ name : String
, context :
{ initGlobalContext : globalContext
, initModuleContext : FileKey -> Node ModuleName -> globalContext -> moduleContext
, fromGlobalToModule : FileKey -> Node ModuleName -> globalContext -> moduleContext
, fromModuleToGlobal : FileKey -> Node ModuleName -> moduleContext -> globalContext
, fold : globalContext -> globalContext -> globalContext
}
@ -571,17 +571,17 @@ newMultiSchema :
->
{ moduleVisitorSchema : Schema ForLookingAtSeveralFiles { hasNoVisitor : () } moduleContext -> Schema ForLookingAtSeveralFiles { hasAtLeastOneVisitor : () } moduleContext
, initGlobalContext : globalContext
, initModuleContext : FileKey -> Node ModuleName -> globalContext -> moduleContext
, fromGlobalToModule : FileKey -> Node ModuleName -> globalContext -> moduleContext
, fromModuleToGlobal : FileKey -> Node ModuleName -> moduleContext -> globalContext
, fold : globalContext -> globalContext -> globalContext
}
-> MultiSchema globalContext moduleContext
newMultiSchema name_ { moduleVisitorSchema, initGlobalContext, initModuleContext, fromModuleToGlobal, fold } =
newMultiSchema name_ { moduleVisitorSchema, initGlobalContext, fromGlobalToModule, fromModuleToGlobal, fold } =
MultiSchema
{ name = name_
, context =
{ initGlobalContext = initGlobalContext
, initModuleContext = initModuleContext
, fromGlobalToModule = fromGlobalToModule
, fromModuleToGlobal = fromModuleToGlobal
, fold = fold
}
@ -670,7 +670,7 @@ allFilesInParallelTraversal (MultiSchema schema) startCache project =
initialModuleContext : moduleContext
initialModuleContext =
schema.context.initModuleContext
schema.context.fromGlobalToModule
fileKey
moduleNameNode_
initialContext
@ -790,7 +790,7 @@ importedModulesFirst (MultiSchema schema) startCache project =
)
-- TODO Remove contexts from parents already handled by other parents
|> List.foldl schema.context.fold initialContext
|> schema.context.initModuleContext fileKey moduleNameNode_
|> schema.context.fromGlobalToModule fileKey moduleNameNode_
moduleVisitor : Schema ForLookingAtSeveralFiles { hasAtLeastOneVisitor : () } moduleContext
moduleVisitor =