* lisp/treesit.el (treesit--indent-rules-optimize):
Optimize 'and' and 'or' matcher forms. When 'and' has a 'query'
matcher inside (as is the case in ruby-ts--indent-rules, many
times over), this yields a significant performance boost.
(pcase func
(`(query ,qry)
(list 'query (treesit-query-compile lang qry)))
+ (`(and . ,fns)
+ (cons 'and (mapcar #'optimize-func fns)))
+ (`(or . ,fns)
+ (cons 'or (mapcar #'optimize-func fns)))
(_ func)))
;; Optimize a rule (MATCHER ANCHOR OFFSET).
(optimize-rule (rule)