mirror of
https://github.com/github/semantic.git
synced 2024-12-21 22:01:46 +03:00
alternate with End in putRubyLocals
This commit is contained in:
parent
ccca1e5857
commit
237ffea294
@ -147,8 +147,10 @@ location = tracing Location `Then` return
|
||||
getRubyLocals :: HasCallStack => Assignment ast grammar [ByteString]
|
||||
getRubyLocals = tracing GetRubyLocals `Then` return
|
||||
|
||||
putRubyLocals :: HasCallStack => [ByteString] -> Assignment ast grammar ()
|
||||
putRubyLocals l = tracing (PutRubyLocals l) `Then` return
|
||||
putRubyLocals :: (HasCallStack, Enum grammar, Eq1 ast, Ix grammar) => [ByteString] -> Assignment ast grammar ()
|
||||
putRubyLocals l = mk (PutRubyLocals l) <|> mk End
|
||||
where
|
||||
mk a = tracing a `Then` return
|
||||
|
||||
-- | Zero-width production of the current node.
|
||||
currentNode :: HasCallStack => Assignment ast grammar (TermF ast (Node grammar) ())
|
||||
|
@ -147,14 +147,14 @@ expressions = makeTerm'' <$> location <*> many expression
|
||||
parenthesizedExpressions :: Assignment
|
||||
parenthesizedExpressions = makeTerm'' <$> symbol ParenthesizedStatements <*> children (Syntax.Paren <$> expressions)
|
||||
|
||||
withExtendedScope :: Assignment.Assignment ast grammar a -> Assignment.Assignment ast grammar a
|
||||
withExtendedScope :: (Enum grammar, Ix grammar, Eq1 ast) => Assignment.Assignment ast grammar a -> Assignment.Assignment ast grammar a
|
||||
withExtendedScope inner = do
|
||||
locals <- getRubyLocals
|
||||
result <- inner
|
||||
putRubyLocals locals
|
||||
pure result
|
||||
|
||||
withNewScope :: Assignment.Assignment ast grammar a -> Assignment.Assignment ast grammar a
|
||||
withNewScope :: (Enum grammar, Ix grammar, Eq1 ast) => Assignment.Assignment ast grammar a -> Assignment.Assignment ast grammar a
|
||||
withNewScope inner = withExtendedScope $ do
|
||||
putRubyLocals []
|
||||
inner
|
||||
|
Loading…
Reference in New Issue
Block a user