mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-25 10:41:47 +03:00
Do not visit and discover expressions if there is no expression visitor
This commit is contained in:
parent
d2f2ffa2cd
commit
11d8c925b2
@ -1894,9 +1894,20 @@ visitDeclaration :
|
||||
-> context
|
||||
-> ( List Error, context )
|
||||
visitDeclaration declarationVisitors expressionVisitors node context =
|
||||
let
|
||||
accumulateExpressionNodes : ( List Error, context ) -> ( List Error, context )
|
||||
accumulateExpressionNodes =
|
||||
if List.isEmpty expressionVisitors.onEnter then
|
||||
identity
|
||||
|
||||
else
|
||||
accumulateList
|
||||
(visitExpression expressionVisitors)
|
||||
(expressionsInDeclaration node)
|
||||
in
|
||||
( [], context )
|
||||
|> visitNodeWithListOfVisitorsAndDirection OnEnter declarationVisitors.onEnter node
|
||||
|> accumulateList (visitExpression expressionVisitors) (expressionsInDeclaration node)
|
||||
|> accumulateExpressionNodes
|
||||
|> visitNodeWithListOfVisitorsAndDirection OnExit declarationVisitors.onExit node
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user