emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/swift-mode 53e6a8c 3/4: Support SE-0317 async let


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode 53e6a8c 3/4: Support SE-0317 async let
Date: Sat, 25 Sep 2021 00:58:12 -0400 (EDT)

branch: elpa/swift-mode
commit 53e6a8c7d1c181871d8009fc741b00774be44d05
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>

    Support SE-0317 async let
    
    
https://github.com/apple/swift-evolution/blob/main/proposals/0317-async-let.md
---
 swift-mode-lexer.el                        | 25 +++++++++++++++++++++++++
 test/swift-files/indent/declarations.swift | 10 ++++++++++
 2 files changed, 35 insertions(+)

diff --git a/swift-mode-lexer.el b/swift-mode-lexer.el
index b0ecfcd..f73444b 100644
--- a/swift-mode-lexer.el
+++ b/swift-mode-lexer.el
@@ -437,6 +437,31 @@ Return nil otherwise."
                  "isolated")))
       nil)
 
+     ;; Before async
+     ;;
+     ;; Examples:
+     ;;
+     ;; func foo() async throws -> Void
+     ;; foo { () async throws -> void in }
+     ;; let f: () async throws -> Void = g
+     ;; get async throws {}
+     ;; async let x = foo()
+     ;;
+     ;; Suppresses implicit semicolon if and only if before let.
+     ;;
+     ;; Example:
+     ;;
+     ;; let a = f as (Int, Int)
+     ;;   async -> Int
+     ;; let b = t as (Int, Int)
+     ;; async
+     ;; let c = 1
+     ((equal (swift-mode:token:text next-token) "async")
+      (equal (swift-mode:token:text (save-excursion
+                                      (swift-mode:forward-token-simple)
+                                      (swift-mode:forward-token-simple)))
+             "let"))
+
      ;; Inserts semicolon before open curly bracket.
      ;;
      ;; Open curly bracket may continue the previous line, but we do not indent
diff --git a/test/swift-files/indent/declarations.swift 
b/test/swift-files/indent/declarations.swift
index 2934376..45fa4e3 100644
--- a/test/swift-files/indent/declarations.swift
+++ b/test/swift-files/indent/declarations.swift
@@ -737,3 +737,13 @@ class Foo {
         return foo
     }
 }
+
+// async let
+
+func foo(f: @escaping (Int, Int) async -> Int, t: (Int, Int)) async {
+    let a = f as (Int, Int)
+      async -> Int
+    let b = t as (Int, Int)
+    async
+    let c = 1
+}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]