Speed up scope_declarationEnterVisitor

This commit is contained in:
Jeroen Engels 2022-09-17 16:42:42 +02:00
parent e519b2b775
commit 5e4665dcbd

View File

@ -6329,7 +6329,13 @@ scope_declarationEnterVisitor node context =
{ context { context
| lookupTable = | lookupTable =
ModuleNameLookupTableInternal.addMultiple ModuleNameLookupTableInternal.addMultiple
(constructors |> ListExtra.orderIndependentConcatMap (Node.value >> .arguments) |> ListExtra.orderIndependentConcatMap (collectModuleNamesFromTypeAnnotation context)) (List.foldl
(\(Node _ constructor) acc ->
collectModuleNamesFromTypeAnnotationHelp context constructor.arguments acc
)
[]
constructors
)
context.lookupTable context.lookupTable
} }
@ -6343,14 +6349,10 @@ scope_declarationEnterVisitor node context =
Declaration.PortDeclaration signature -> Declaration.PortDeclaration signature ->
let let
moduleNamesFromSignature : List ( Range, ModuleName )
moduleNamesFromSignature =
collectModuleNamesFromTypeAnnotation context signature.typeAnnotation
lookupTable : ModuleNameLookupTable lookupTable : ModuleNameLookupTable
lookupTable = lookupTable =
ModuleNameLookupTableInternal.addMultiple ModuleNameLookupTableInternal.addMultiple
moduleNamesFromSignature (collectModuleNamesFromTypeAnnotation context signature.typeAnnotation)
context.lookupTable context.lookupTable
in in
{ context | lookupTable = lookupTable } { context | lookupTable = lookupTable }