mirror of
https://github.com/github/semantic.git
synced 2024-12-22 14:21:31 +03:00
Track changes to ruby rescue productions
This commit is contained in:
parent
8d0297d89f
commit
8d9e864b0a
@ -132,8 +132,9 @@ data Category
|
||||
| Ensure
|
||||
| Rescue
|
||||
| RescueModifier
|
||||
| When
|
||||
| RescuedException
|
||||
| RescueArgs
|
||||
| When
|
||||
| Negate
|
||||
deriving (Eq, Generic, Ord, Show)
|
||||
|
||||
@ -201,8 +202,9 @@ instance Arbitrary Category where
|
||||
, pure Ensure
|
||||
, pure Rescue
|
||||
, pure RescueModifier
|
||||
, pure When
|
||||
, pure RescuedException
|
||||
, pure RescueArgs
|
||||
, pure When
|
||||
, pure Negate
|
||||
, Other <$> arbitrary
|
||||
]
|
||||
|
@ -388,6 +388,7 @@ instance HasCategory Category where
|
||||
C.RescueModifier -> "rescue modifier"
|
||||
C.When -> "when comparison"
|
||||
C.RescuedException -> "last exception"
|
||||
C.RescueArgs -> "arguments"
|
||||
C.Negate -> "negate"
|
||||
|
||||
instance HasField fields Category => HasCategory (SyntaxTerm leaf fields) where
|
||||
|
@ -102,10 +102,10 @@ termConstructor source sourceSpan name range children
|
||||
("module_declaration", _ ) -> S.Error children
|
||||
("rescue_block", _ ) -> case children of
|
||||
args : lastException : rest
|
||||
| Args <- category (extract args)
|
||||
| RescueArgs <- category (extract args)
|
||||
, RescuedException <- category (extract lastException) -> S.Rescue (toList (unwrap args) <> [lastException]) rest
|
||||
lastException : rest | RescuedException <- category (extract lastException) -> S.Rescue [lastException] rest
|
||||
args : body | Args <- category (extract args) -> S.Rescue (toList (unwrap args)) body
|
||||
args : body | RescueArgs <- category (extract args) -> S.Rescue (toList (unwrap args)) body
|
||||
body -> S.Rescue [] body
|
||||
("rescue_modifier", [lhs, rhs] ) -> S.Rescue [lhs] [rhs]
|
||||
("rescue_modifier", _ ) -> S.Error children
|
||||
@ -165,7 +165,6 @@ categoryForRubyName = \case
|
||||
"if_statement" -> If
|
||||
"integer" -> IntegerLiteral
|
||||
"interpolation" -> Interpolation
|
||||
"rescued_exception" -> RescuedException
|
||||
"math_assignment" -> MathAssignment
|
||||
"member_access" -> MemberAccess
|
||||
"method_declaration" -> Method
|
||||
@ -175,8 +174,10 @@ categoryForRubyName = \case
|
||||
"program" -> Program
|
||||
"regex" -> Regex
|
||||
"relational" -> RelationalOperator -- relational operator, e.g. ==, !=, ===, <=>, =~, !~.
|
||||
"rescue_arguments" -> RescueArgs
|
||||
"rescue_block" -> Rescue
|
||||
"rescue_modifier" -> RescueModifier
|
||||
"rescued_exception" -> RescuedException
|
||||
"return_statement" -> Return
|
||||
"shift" -> BitwiseOperator -- bitwise shift, e.g <<, >>.
|
||||
"string" -> StringLiteral
|
||||
|
@ -97,6 +97,7 @@ styleName category = "category-" <> case category of
|
||||
C.RescueModifier -> "rescue_modifier"
|
||||
C.When -> "when_block"
|
||||
C.RescuedException -> "last_exception"
|
||||
C.RescueArgs -> "rescue_args"
|
||||
C.Negate -> "negate"
|
||||
|
||||
-- | Pick the class name for a split patch.
|
||||
|
Loading…
Reference in New Issue
Block a user