mirror of
https://github.com/github/semantic.git
synced 2025-01-02 20:41:38 +03:00
ruby: use methodSelector rather than plainIdentifier for def names
This commit is contained in:
parent
66720795cc
commit
c5be01e8a0
@ -184,10 +184,6 @@ identifier =
|
|||||||
then pure $ makeTerm loc (Syntax.Identifier (name ident))
|
then pure $ makeTerm loc (Syntax.Identifier (name ident))
|
||||||
else makeTerm loc <$> (Expression.Call [] (makeTerm loc (Syntax.Identifier (name ident))) [] <$> emptyTerm)
|
else makeTerm loc <$> (Expression.Call [] (makeTerm loc (Syntax.Identifier (name ident))) [] <$> emptyTerm)
|
||||||
|
|
||||||
-- Regular identifiers prioritized over vcalls.
|
|
||||||
plainIdentifier :: Assignment
|
|
||||||
plainIdentifier = makeTerm <$> (symbol Identifier <|> symbol Identifier') <*> (Syntax.Identifier . name <$> source)
|
|
||||||
|
|
||||||
-- TODO: Handle interpolation in all literals that support it (strings, regexes, symbols, subshells, etc).
|
-- TODO: Handle interpolation in all literals that support it (strings, regexes, symbols, subshells, etc).
|
||||||
literal :: Assignment
|
literal :: Assignment
|
||||||
literal =
|
literal =
|
||||||
@ -243,12 +239,12 @@ parameter =
|
|||||||
where mk s = makeTerm <$> symbol s <*> (Syntax.Identifier . name <$> source)
|
where mk s = makeTerm <$> symbol s <*> (Syntax.Identifier . name <$> source)
|
||||||
|
|
||||||
method :: Assignment
|
method :: Assignment
|
||||||
method = makeTerm <$> symbol Method <*> (withNewScope . children) (Declaration.Method <$> pure [] <*> emptyTerm <*> (plainIdentifier <|> expression) <*> params <*> expressions')
|
method = makeTerm <$> symbol Method <*> (withNewScope . children) (Declaration.Method <$> pure [] <*> emptyTerm <*> methodSelector <*> params <*> expressions')
|
||||||
where params = symbol MethodParameters *> children (many parameter) <|> pure []
|
where params = symbol MethodParameters *> children (many parameter) <|> pure []
|
||||||
expressions' = makeTerm <$> location <*> many expression
|
expressions' = makeTerm <$> location <*> many expression
|
||||||
|
|
||||||
singletonMethod :: Assignment
|
singletonMethod :: Assignment
|
||||||
singletonMethod = makeTerm <$> symbol SingletonMethod <*> (withNewScope . children) (Declaration.Method <$> pure [] <*> expression <*> expression <*> params <*> expressions)
|
singletonMethod = makeTerm <$> symbol SingletonMethod <*> (withNewScope . children) (Declaration.Method <$> pure [] <*> expression <*> methodSelector <*> params <*> expressions)
|
||||||
where params = symbol MethodParameters *> children (many parameter) <|> pure []
|
where params = symbol MethodParameters *> children (many parameter) <|> pure []
|
||||||
|
|
||||||
lambda :: Assignment
|
lambda :: Assignment
|
||||||
|
Loading…
Reference in New Issue
Block a user