branch: elpa/swift-mode
commit 8b5b45665e84e805c1f8edefecb80e0bf8c36e03
Author: taku0 <mxxouy6x3m_git...@tatapa.org>
Commit: taku0 <mxxouy6x3m_git...@tatapa.org>

    Support `isolated deinit`
    
    
https://github.com/swiftlang/swift-evolution/blob/main/proposals/0371-isolated-synchronous-deinit.md
---
 swift-mode-indent.el                       |  2 +-
 swift-mode-lexer.el                        | 10 +++++-----
 test/swift-files/indent/declarations.swift |  9 +++++++++
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/swift-mode-indent.el b/swift-mode-indent.el
index 9df93bd40a..c646f874dc 100644
--- a/swift-mode-indent.el
+++ b/swift-mode-indent.el
@@ -1042,7 +1042,7 @@ OFFSET is the offset of the contents."
              (swift-mode:token:text next-token)
              '("for" "while" "repeat" "guard" "switch" "if" "else"
                "defer" "do" "catch"
-               "get" "set" "willSet" "didSet" "func" "init" "subscript"
+               "get" "set" "willSet" "didSet" "func" "init" "deinit" 
"subscript"
                "enum" "struct" "actor" "class" "extension"
                "prefix" "postfix" "infix" "precedencegroup"))
             (setq is-declaration-or-control-statement-body t)
diff --git a/swift-mode-lexer.el b/swift-mode-lexer.el
index 0592da8b27..c2db30c677 100644
--- a/swift-mode-lexer.el
+++ b/swift-mode-lexer.el
@@ -667,10 +667,10 @@ return non-nil."
        ;; statements.
        (member (swift-mode:token:text previous-token)
                '("any" "some" "inout" "borrowing" "consuming" "sending" "in"
-                 "where" "isolated" "each"))
+                 "where" "each"))
        (member (swift-mode:token:text next-token)
                '("any" "some" "inout" "borrowing" "consuming" "sending" 
"throws"
-                 "rethrows" "in" "where" "isolated" "each"))
+                 "rethrows" "in" "where" "each"))
 
        ;; Suppress implicit semicolon between throws and open parenthesis.
        (and (equal (swift-mode:token:text previous-token) "throws")
@@ -738,7 +738,7 @@ return non-nil."
                 "mutating" "nonmutating" "optional" "override" "postfix"
                 "prefix" "required" "static" "unowned" "weak" "internal"
                 "package" "private" "public" "open" "fileprivate" "nonisolated"
-                "distributed"))
+                "distributed" "isolated"))
       nil)
 
      ;; internal(set) private(set) public(set) open(set) fileprivate(set)
@@ -756,7 +756,7 @@ return non-nil."
                    (swift-mode:backquote-identifier-if-after-dot
                     (swift-mode:backward-token-simple)))
                   '("unowned" "internal" "private" "public" "open"
-                    "fileprivate" "nonisolated")))))
+                    "fileprivate" "nonisolated" "isolated")))))
       nil)
 
      ;; Suppress implicit semicolon after declaration starters.
@@ -774,7 +774,7 @@ return non-nil."
                 "mutating" "nonmutating" "optional" "override" "postfix"
                 "prefix" "required" "static" "unowned" "weak" "internal"
                 "package" "private" "public" "open" "fileprivate" "nonisolated"
-                "distributed"))
+                "distributed" "isolated"))
       t)
 
      ;; Inserts implicit semicolon around keywords that forms single keyword
diff --git a/test/swift-files/indent/declarations.swift 
b/test/swift-files/indent/declarations.swift
index 8641f1d7b3..378129288d 100644
--- a/test/swift-files/indent/declarations.swift
+++ b/test/swift-files/indent/declarations.swift
@@ -826,6 +826,15 @@ class Foo {
           )
           var x = 1
     }
+
+    // 
https://github.com/swiftlang/swift-evolution/blob/main/proposals/0371-isolated-synchronous-deinit.md
+    isolated
+      deinit {
+    }
+
+    public
+      deinit {
+    }
 }
 
 // async let

Reply via email to