1
1
mirror of https://github.com/github/semantic.git synced 2025-01-02 20:41:38 +03:00

ruby: change sendBlock field type to Maybe a

This commit is contained in:
Charlie Somerville 2018-04-06 11:45:39 +10:00
parent 1b998409d3
commit 76726e194c
2 changed files with 4 additions and 4 deletions

View File

@ -295,9 +295,9 @@ pair = makeTerm <$> symbol Pair <*> children (Literal.KeyValue <$> expression
methodCall :: Assignment
methodCall = makeTerm' <$> symbol MethodCall <*> children (require <|> load <|> funcCall <|> regularCall)
where
funcCall = inj <$> (Ruby.Syntax.Send Nothing <$> methodSelector <*> args <*> (block <|> emptyTerm))
funcCall = inj <$> (Ruby.Syntax.Send Nothing <$> methodSelector <*> args <*> optional block)
regularCall = inj <$> (symbol Call *> children (Ruby.Syntax.Send <$> (Just <$> expression) <*> methodSelector) <*> args <*> (block <|> emptyTerm))
regularCall = inj <$> (symbol Call *> children (Ruby.Syntax.Send <$> (Just <$> expression) <*> methodSelector) <*> args <*> optional block)
require = inj <$> (symbol Identifier *> do
s <- source
@ -317,7 +317,7 @@ methodSelector = mk Identifier <|> mk Identifier'
mk s = makeTerm <$> symbol s <*> (Syntax.Identifier <$> (name <$> source))
call :: Assignment
call = makeTerm <$> symbol Call <*> children (Ruby.Syntax.Send <$> (Just <$> expression) <*> methodSelector <*> pure [] <*> (block <|> emptyTerm))
call = makeTerm <$> symbol Call <*> children (Ruby.Syntax.Send <$> (Just <$> expression) <*> methodSelector <*> pure [] <*> optional block)
rescue :: Assignment
rescue = rescue'

View File

@ -36,7 +36,7 @@ maybeFailNotFound name = maybeFail notFound
cleanNameOrPath :: ByteString -> String
cleanNameOrPath = BC.unpack . dropRelativePrefix . stripQuotes
data Send a = Send { sendReceiver :: Maybe a, sendSelector :: a, sendArgs :: [a], sendBlock :: a }
data Send a = Send { sendReceiver :: Maybe a, sendSelector :: a, sendArgs :: [a], sendBlock :: Maybe a }
deriving (Diffable, Eq, Foldable, Functor, GAlign, Generic1, Mergeable, Ord, Show, Traversable, FreeVariables1)
instance Eq1 Send where liftEq = genericLiftEq