Skip to content

Commit

Permalink
Split pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
jfmengels committed Sep 8, 2024
1 parent 9b2b19d commit f45c2ae
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 43 deletions.
20 changes: 11 additions & 9 deletions src/Review/ModuleNameLookupTable/Compute.elm
Original file line number Diff line number Diff line change
Expand Up @@ -433,15 +433,17 @@ collectLookupTable declarations context =
visitExpressions : Node Expression -> Context -> Context
visitExpressions node context =
-- IGNORE TCO
context
|> popScopeEnter node
|> expressionEnterVisitor node
|> (\newContext ->
List.foldl
visitExpressions
newContext
(expressionChildren node)
)
let
newContext : Context
newContext =
context
|> popScopeEnter node
|> expressionEnterVisitor node
in
List.foldl
visitExpressions
newContext
(expressionChildren node)
|> popScopeExit node
|> expressionExitVisitor node

Expand Down
77 changes: 43 additions & 34 deletions src/Review/Rule.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5862,55 +5862,64 @@ visitDeclarationsAndExpressions declarations rules =

visitDeclarationAndExpressions : Node Declaration -> JsArray RuleModuleVisitor -> JsArray RuleModuleVisitor
visitDeclarationAndExpressions declaration rules =
rules
|> mutatingMap (\acc -> runVisitor .declarationVisitorOnEnter declaration acc)
|> (\updatedRules ->
case Node.value declaration of
Declaration.FunctionDeclaration function ->
visitExpression (Node.value function.declaration |> .expression) updatedRules
let
updatedRules : JsArray RuleModuleVisitor
updatedRules =
rules
|> mutatingMap (\acc -> runVisitor .declarationVisitorOnEnter declaration acc)
in
(case Node.value declaration of
Declaration.FunctionDeclaration function ->
visitExpression (Node.value function.declaration |> .expression) updatedRules

_ ->
updatedRules
)
_ ->
updatedRules
)
|> mutatingMap (\acc -> runVisitor .declarationVisitorOnExit declaration acc)


visitExpression : Node Expression -> JsArray RuleModuleVisitor -> JsArray RuleModuleVisitor
visitExpression node rules =
case Node.value node of
Expression.LetExpression letBlock ->
rules
|> mutatingMap (\acc -> runVisitor .expressionVisitorOnEnter node acc)
|> (\updatedRules ->
List.foldl
(visitLetDeclaration (Node (Node.range node) letBlock))
updatedRules
letBlock.declarations
)
let
updatedRules : JsArray RuleModuleVisitor
updatedRules =
rules
|> mutatingMap (\acc -> runVisitor .expressionVisitorOnEnter node acc)
in
List.foldl
(visitLetDeclaration (Node (Node.range node) letBlock))
updatedRules
letBlock.declarations
|> visitExpression letBlock.expression
|> mutatingMap (\acc -> runVisitor .expressionVisitorOnExit node acc)

Expression.CaseExpression caseBlock ->
rules
|> mutatingMap (\acc -> runVisitor .expressionVisitorOnEnter node acc)
|> visitExpression caseBlock.expression
|> (\updatedRules ->
List.foldl
(\case_ acc -> visitCaseBranch (Node (Node.range node) caseBlock) case_ acc)
updatedRules
caseBlock.cases
)
let
updatedRules : JsArray RuleModuleVisitor
updatedRules =
rules
|> mutatingMap (\acc -> runVisitor .expressionVisitorOnEnter node acc)
|> visitExpression caseBlock.expression
in
List.foldl
(\case_ acc -> visitCaseBranch (Node (Node.range node) caseBlock) case_ acc)
updatedRules
caseBlock.cases
|> mutatingMap (\acc -> runVisitor .expressionVisitorOnExit node acc)

_ ->
rules
|> mutatingMap (\acc -> runVisitor .expressionVisitorOnEnter node acc)
|> (\updatedRules ->
List.foldl
visitExpression
updatedRules
(expressionChildren node)
)
let
updatedRules : JsArray RuleModuleVisitor
updatedRules =
rules
|> mutatingMap (\acc -> runVisitor .expressionVisitorOnEnter node acc)
in
List.foldl
visitExpression
updatedRules
(expressionChildren node)
|> mutatingMap (\acc -> runVisitor .expressionVisitorOnExit node acc)


Expand Down

0 comments on commit f45c2ae

Please sign in to comment.