mirror of
https://github.com/jfmengels/elm-review.git
synced 2024-11-23 06:44:41 +03:00
26 lines
696 B
Elm
26 lines
696 B
Elm
module Simplify.AstHelpers exposing (removeParens, removeParensFromPattern)
|
|
|
|
import Elm.Syntax.Expression as Expression exposing (Expression)
|
|
import Elm.Syntax.Node as Node exposing (Node)
|
|
import Elm.Syntax.Pattern as Pattern exposing (Pattern)
|
|
|
|
|
|
removeParens : Node Expression -> Node Expression
|
|
removeParens node =
|
|
case Node.value node of
|
|
Expression.ParenthesizedExpression expr ->
|
|
removeParens expr
|
|
|
|
_ ->
|
|
node
|
|
|
|
|
|
removeParensFromPattern : Node Pattern -> Node Pattern
|
|
removeParensFromPattern node =
|
|
case Node.value node of
|
|
Pattern.ParenthesizedPattern pattern ->
|
|
removeParensFromPattern pattern
|
|
|
|
_ ->
|
|
node
|