1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 01:47:01 +03:00

allow method invocation to have empty argument lists

This commit is contained in:
Ayman Nadeem 2018-05-31 14:49:22 -07:00
parent c57b8051c4
commit 2684b34bcb
2 changed files with 11 additions and 8 deletions

View File

@ -1,7 +1,2 @@
if (t instanceof VirtualMachineError) { public abstract class ConnectableFlowable<T> extends Flowable<T> {
throw (VirtualMachineError) t;
} else if (t instanceof ThreadDeath) {
throw (ThreadDeath) t;
} else if (t instanceof LinkageError) {
throw (LinkageError) t;
} }

View File

@ -295,7 +295,7 @@ generic = makeTerm <$> symbol Grammar.GenericType <*> children(Java.Syntax.Gener
-- Q to help decide: do we lose anything by omitting the term? -- Q to help decide: do we lose anything by omitting the term?
methodInvocation :: Assignment methodInvocation :: Assignment
methodInvocation = makeTerm <$> symbol MethodInvocation <*> children (Expression.Call [] <$> (callFunction <$> term expression <*> optional (token AnonDot *> term expression)) <*> argumentList <*> emptyTerm) methodInvocation = makeTerm <$> symbol MethodInvocation <*> children (Expression.Call [] <$> (callFunction <$> expression <*> optional (token AnonDot *> expression)) <*> (argumentList <|> pure []) <*> emptyTerm)
where where
callFunction a (Just b) = makeTerm1 (Expression.MemberAccess a b) callFunction a (Just b) = makeTerm1 (Expression.MemberAccess a b)
callFunction a Nothing = a callFunction a Nothing = a
@ -325,7 +325,15 @@ interface = makeTerm <$> symbol InterfaceDeclaration <*> children (normal <|> an
-- we won't make a term because we have a choice of a bunch of things -- we won't make a term because we have a choice of a bunch of things
package :: Assignment package :: Assignment
package = makeTerm <$> symbol PackageDeclaration <*> children (Java.Syntax.Package <$> someTerm expression) -- package = makeTerm <$> symbol PackageDeclaration <*> children (Java.Syntax.Package <$> someTerm expression)
package = do
loc <- symbol PackageDeclaration -- location which is calling the symbol API
c <- children $ do
expressions <- someTerm expression
pure (Java.Syntax.Package expressions)
pure (makeTerm loc c) -- pure is re-wrapping it back into the outer context, which in this case is Assignment (ie., the return type of the function)
enum :: Assignment enum :: Assignment
enum = makeTerm <$> symbol Grammar.EnumDeclaration <*> children (Java.Syntax.EnumDeclaration <$> term identifier <*> manyTerm enumConstant) enum = makeTerm <$> symbol Grammar.EnumDeclaration <*> children (Java.Syntax.EnumDeclaration <$> term identifier <*> manyTerm enumConstant)