mirror of
https://github.com/github/semantic.git
synced 2024-12-19 12:51:52 +03:00
Change methodParams to be a list of args
This commit is contained in:
parent
1d79153f01
commit
5615da1bc0
@ -69,8 +69,10 @@ termConstructor source sourceSpan info = fmap cofree . construct
|
||||
_ -> errorWith children
|
||||
|
||||
construct children | FunctionCall == category info = case runCofree <$> children of
|
||||
[ (_ :< S.MemberAccess{..}), params@(_ :< S.Args{}) ] ->
|
||||
pure $! setCategory info MethodCall :< S.MethodCall memberId property (cofree params)
|
||||
[ (_ :< S.MemberAccess{..}), params@(_ :< S.Args args) ] ->
|
||||
pure $! setCategory info MethodCall :< S.MethodCall memberId property args
|
||||
[ (_ :< S.MemberAccess{..}) ] ->
|
||||
pure $! setCategory info MethodCall :< S.MethodCall memberId property []
|
||||
(x:xs) ->
|
||||
withDefaultInfo $ S.FunctionCall (cofree x) (cofree <$> xs)
|
||||
_ -> errorWith children
|
||||
|
@ -33,7 +33,7 @@ data Syntax a f
|
||||
| MemberAccess { memberId :: f, property :: f }
|
||||
-- | A method call consisting of its target, the method name, and the parameters passed to the method.
|
||||
-- | e.g. in Javascript console.log('hello') represents a method call.
|
||||
| MethodCall { targetId :: f, methodId :: f, methodParams :: f }
|
||||
| MethodCall { targetId :: f, methodId :: f, methodParams :: [f] }
|
||||
-- | The list of arguments to a method call.
|
||||
-- | TODO: It might be worth removing this and using Fixed instead.
|
||||
| Args [f]
|
||||
|
Loading…
Reference in New Issue
Block a user