@@ -269,6 +269,21 @@ one is present, returning t if so and nil otherwise"
269
269
(swift-skip-comments-and-space))))
270
270
found))
271
271
272
+ (defun swift-skip-constraint ()
273
+ " Hop over a single type constraint if one is present,
274
+ returning t if so and nil otherwise"
275
+ (swift-skip-comments-and-space)
276
+ (and (swift-skip-type-name)
277
+ (swift-skip-re " :\\ |==" )
278
+ (swift-skip-type-name)))
279
+
280
+ (defun swift-skip-where-clause ()
281
+ " Hop over a where clause if one is present, returning t if so
282
+ and nil otherwise"
283
+ (when (swift-skip-re " \\ <where\\ >" )
284
+ (while (and (swift-skip-constraint) (swift-skip-re " ," )))
285
+ t ))
286
+
272
287
(defun swift-in-string-or-comment ()
273
288
" Return non-nil if point is in a string or comment."
274
289
(or (nth 3 (syntax-ppss )) (nth 4 (syntax-ppss ))))
@@ -311,7 +326,8 @@ Use `M-x hs-show-all' to show them again."
311
326
(swift-skip-comments-and-space)
312
327
(equal (char-after ) ?\( ))
313
328
; ; parse the parameter list and any return type
314
- (swift-skip-type-name)))))
329
+ (swift-skip-type-name)
330
+ (swift-skip-where-clause)))))
315
331
(swift-skip-re " {" ))
316
332
(hs-hide-block :reposition-at-end ))))))
317
333
0 commit comments