Skip to content

Commit

Permalink
Extract function
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed Sep 3, 2023
1 parent f01508a commit 2ee409c
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/Review/ModuleNameLookupTable/Compute.elm
Original file line number Diff line number Diff line change
Expand Up @@ -594,19 +594,22 @@ registerDeclaration declaration innerContext =
|> registerIfExposed (\name ctx -> registerExposedValue function name ctx) (Node.value nameNode)

Declaration.AliasDeclaration alias ->
{ innerContext | localTypes = Set.insert (Node.value alias.name) innerContext.localTypes }
|> (\ctx ->
case Node.value alias.typeAnnotation of
TypeAnnotation.Record _ ->
addToScope
{ variableType = TopLevelVariable
, node = alias.name
}
ctx

_ ->
let
registerAlias : Context -> Context
registerAlias ctx =
case Node.value alias.typeAnnotation of
TypeAnnotation.Record _ ->
addToScope
{ variableType = TopLevelVariable
, node = alias.name
}
ctx
)

_ ->
ctx
in
{ innerContext | localTypes = Set.insert (Node.value alias.name) innerContext.localTypes }
|> registerAlias
|> registerIfExposed registerExposedTypeAlias (Node.value alias.name)

Declaration.CustomTypeDeclaration { name, constructors } ->
Expand Down

0 comments on commit 2ee409c

Please sign in to comment.