Skip to content

Commit 53e6a8c

Browse files
committed
1 parent 9e220cb commit 53e6a8c

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

swift-mode-lexer.el

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,31 @@ Return nil otherwise."
437437
"isolated")))
438438
nil)
439439

440+
;; Before async
441+
;;
442+
;; Examples:
443+
;;
444+
;; func foo() async throws -> Void
445+
;; foo { () async throws -> void in }
446+
;; let f: () async throws -> Void = g
447+
;; get async throws {}
448+
;; async let x = foo()
449+
;;
450+
;; Suppresses implicit semicolon if and only if before let.
451+
;;
452+
;; Example:
453+
;;
454+
;; let a = f as (Int, Int)
455+
;; async -> Int
456+
;; let b = t as (Int, Int)
457+
;; async
458+
;; let c = 1
459+
((equal (swift-mode:token:text next-token) "async")
460+
(equal (swift-mode:token:text (save-excursion
461+
(swift-mode:forward-token-simple)
462+
(swift-mode:forward-token-simple)))
463+
"let"))
464+
440465
;; Inserts semicolon before open curly bracket.
441466
;;
442467
;; Open curly bracket may continue the previous line, but we do not indent

test/swift-files/indent/declarations.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,3 +737,13 @@ class Foo {
737737
return foo
738738
}
739739
}
740+
741+
// async let
742+
743+
func foo(f: @escaping (Int, Int) async -> Int, t: (Int, Int)) async {
744+
let a = f as (Int, Int)
745+
async -> Int
746+
let b = t as (Int, Int)
747+
async
748+
let c = 1
749+
}

0 commit comments

Comments
 (0)