github.com/terraform-linters/tflint-plugin-sdk@v0.22.0/tflint/walker.go (about)

     1  package tflint
     2  
     3  import (
     4  	"github.com/hashicorp/hcl/v2"
     5  )
     6  
     7  // ExprWalker is an interface used with WalkExpressions.
     8  type ExprWalker interface {
     9  	Enter(expr hcl.Expression) hcl.Diagnostics
    10  	Exit(expr hcl.Expression) hcl.Diagnostics
    11  }
    12  
    13  // ExprWalkFunc is the callback signature for WalkExpressions.
    14  // This satisfies the ExprWalker interface.
    15  type ExprWalkFunc func(expr hcl.Expression) hcl.Diagnostics
    16  
    17  // Enter is a function of ExprWalker that invokes itself on the passed expression.
    18  func (f ExprWalkFunc) Enter(expr hcl.Expression) hcl.Diagnostics {
    19  	return f(expr)
    20  }
    21  
    22  // Exit is one of ExprWalker's functions, noop here
    23  func (f ExprWalkFunc) Exit(expr hcl.Expression) hcl.Diagnostics {
    24  	return nil
    25  }