mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-16 18:30:06 -04:00
fix(haskell): prevent segfault due to anchorless queries (#5502)
This commit is contained in:
parent
34e6ace726
commit
0eb1a0ad1c
2 changed files with 31 additions and 36 deletions
|
|
@ -162,26 +162,11 @@
|
||||||
;; Functions and variables
|
;; Functions and variables
|
||||||
|
|
||||||
(signature name: (variable) @function)
|
(signature name: (variable) @function)
|
||||||
((signature name: (variable) @variable)
|
|
||||||
(function
|
|
||||||
name: (variable) @_name
|
|
||||||
rhs: [
|
|
||||||
(exp_literal)
|
|
||||||
(exp_apply
|
|
||||||
(exp_name
|
|
||||||
[(constructor)
|
|
||||||
(variable)
|
|
||||||
]))
|
|
||||||
(quasiquote)
|
|
||||||
((exp_name) . (operator))
|
|
||||||
])
|
|
||||||
(#eq? @variable @_name))
|
|
||||||
|
|
||||||
((signature name: (variable) @variable)
|
((signature name: (variable) @variable)
|
||||||
(function
|
. (function
|
||||||
name: (variable) @_name
|
name: (variable) @_name
|
||||||
rhs: (exp_infix
|
rhs: [
|
||||||
[
|
|
||||||
(exp_literal)
|
(exp_literal)
|
||||||
(exp_apply
|
(exp_apply
|
||||||
(exp_name
|
(exp_name
|
||||||
|
|
@ -190,26 +175,36 @@
|
||||||
]))
|
]))
|
||||||
(quasiquote)
|
(quasiquote)
|
||||||
((exp_name) . (operator))
|
((exp_name) . (operator))
|
||||||
]))
|
])
|
||||||
|
(#eq? @variable @_name))
|
||||||
|
|
||||||
|
((signature name: (variable) @variable)
|
||||||
|
. (function
|
||||||
|
name: (variable) @_name
|
||||||
|
rhs: (exp_infix
|
||||||
|
[
|
||||||
|
(exp_literal)
|
||||||
|
(exp_apply
|
||||||
|
(exp_name
|
||||||
|
[(constructor)
|
||||||
|
(variable)
|
||||||
|
]))
|
||||||
|
(quasiquote)
|
||||||
|
((exp_name) . (operator))
|
||||||
|
]))
|
||||||
(#eq? @variable @_name))
|
(#eq? @variable @_name))
|
||||||
|
|
||||||
((signature name: (variable) @function)
|
((signature name: (variable) @function)
|
||||||
(function
|
. (function
|
||||||
name: (variable) @_name
|
name: (variable) @_name
|
||||||
patterns: (patterns))
|
patterns: (patterns))
|
||||||
(#eq? @function @_name))
|
(#eq? @function @_name))
|
||||||
|
|
||||||
(signature
|
;; For some reason, `(signature name: (variable) type: (fun))` doesn't work here
|
||||||
name: (variable) @function
|
(signature (variable) @function . (fun))
|
||||||
type: (fun))
|
|
||||||
((signature
|
|
||||||
name: (variable) @_name
|
|
||||||
type: (fun))
|
|
||||||
(function
|
|
||||||
name: (variable) @function)
|
|
||||||
(#eq? @function @_name))
|
|
||||||
|
|
||||||
(function name: (variable) @function)
|
(function name: (variable) @function)
|
||||||
|
|
||||||
(function
|
(function
|
||||||
name: (variable) @variable
|
name: (variable) @variable
|
||||||
rhs: [
|
rhs: [
|
||||||
|
|
@ -222,6 +217,7 @@
|
||||||
(quasiquote)
|
(quasiquote)
|
||||||
((exp_name) . (operator))
|
((exp_name) . (operator))
|
||||||
])
|
])
|
||||||
|
|
||||||
(function
|
(function
|
||||||
name: (variable) @variable
|
name: (variable) @variable
|
||||||
rhs: (exp_infix [
|
rhs: (exp_infix [
|
||||||
|
|
|
||||||
|
|
@ -111,16 +111,13 @@ someInfix x = fromIntegral x `myAdd` floatVal
|
||||||
-- ^ @variable
|
-- ^ @variable
|
||||||
-- ^ @variable
|
-- ^ @variable
|
||||||
floatVal :: Double
|
floatVal :: Double
|
||||||
-- ^ @variable
|
|
||||||
floatVal = 5.5
|
floatVal = 5.5
|
||||||
-- ^ @variable
|
-- ^ @variable
|
||||||
-- ^ @float
|
-- ^ @float
|
||||||
intVal :: Int
|
intVal :: Int
|
||||||
-- ^ @variable
|
|
||||||
intVal = getInt 5
|
intVal = getInt 5
|
||||||
-- ^ @variable
|
-- ^ @variable
|
||||||
boolVal :: Bool
|
boolVal :: Bool
|
||||||
-- ^ @variable
|
|
||||||
boolVal = bool False True $ 1 + 2 == 3
|
boolVal = bool False True $ 1 + 2 == 3
|
||||||
-- ^ @variable
|
-- ^ @variable
|
||||||
isInt :: Either Double Int -> Bool
|
isInt :: Either Double Int -> Bool
|
||||||
|
|
@ -171,12 +168,14 @@ someIOaction = do
|
||||||
-- ^ @function.call
|
-- ^ @function.call
|
||||||
|
|
||||||
intVal :: Int
|
intVal :: Int
|
||||||
-- ^ @variable
|
|
||||||
intVal = 5
|
intVal = 5
|
||||||
-- ^ @variable
|
-- ^ @variable
|
||||||
|
|
||||||
|
intFun :: Int -> Int
|
||||||
|
intFun = 5
|
||||||
|
-- ^ @function
|
||||||
|
|
||||||
mbInt :: Maybe Int
|
mbInt :: Maybe Int
|
||||||
-- ^ @variable
|
|
||||||
mbInt = Just 5
|
mbInt = Just 5
|
||||||
-- ^ @variable
|
-- ^ @variable
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue