mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-12-23 17:53:35 +03:00
Add expressionVisitor
This commit is contained in:
parent
6f206f8392
commit
77390095c4
@ -1317,6 +1317,14 @@ mergeModuleVisitors initialProjectContext maybeModuleContextCreator visitors =
|
||||
fromModuleRuleSchemaToRunnableModuleVisitor : ModuleRuleSchema schemaState moduleContext -> RunnableModuleVisitor moduleContext
|
||||
fromModuleRuleSchemaToRunnableModuleVisitor (ModuleRuleSchema schema) =
|
||||
let
|
||||
expressionVisitor : List (Node Expression) -> ( List (Error {}), moduleContext ) -> ( List (Error {}), moduleContext )
|
||||
expressionVisitor =
|
||||
if shouldVisitExpressions schema then
|
||||
accumulateList (visitExpression expressionVisitorRecord)
|
||||
|
||||
else
|
||||
\_ errorsAndContext -> errorsAndContext
|
||||
|
||||
declarationAndExpressionVisitor : List (Node Declaration) -> ( List (Error {}), moduleContext ) -> ( List (Error {}), moduleContext )
|
||||
declarationAndExpressionVisitor =
|
||||
if shouldVisitDeclarationsAndExpressions schema then
|
||||
@ -4365,6 +4373,16 @@ shouldVisitDeclarationsAndExpressions schema =
|
||||
|| not (List.isEmpty schema.caseBranchVisitorsOnExit)
|
||||
|
||||
|
||||
shouldVisitExpressions : ModuleRuleSchemaData moduleContext -> Bool
|
||||
shouldVisitExpressions schema =
|
||||
not (List.isEmpty schema.expressionVisitorsOnEnter)
|
||||
|| not (List.isEmpty schema.expressionVisitorsOnExit)
|
||||
|| not (List.isEmpty schema.letDeclarationVisitorsOnEnter)
|
||||
|| not (List.isEmpty schema.letDeclarationVisitorsOnExit)
|
||||
|| not (List.isEmpty schema.caseBranchVisitorsOnEnter)
|
||||
|| not (List.isEmpty schema.caseBranchVisitorsOnExit)
|
||||
|
||||
|
||||
type alias ExpressionRelatedVisitors moduleContext =
|
||||
{ expressionVisitorsOnEnter : List (Visitor Expression moduleContext)
|
||||
, expressionVisitorsOnExit : List (Visitor Expression moduleContext)
|
||||
|
Loading…
Reference in New Issue
Block a user