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

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

[nongnu] elpa/swift-mode be8d770 446/496: Fix indentation after `class'


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode be8d770 446/496: Fix indentation after `class' modifier
Date: Sun, 29 Aug 2021 11:34:25 -0400 (EDT)

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

    Fix indentation after `class' modifier
---
 swift-mode-lexer.el                        | 12 +++----
 test/swift-files/indent/declarations.swift | 56 ++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 6 deletions(-)

diff --git a/swift-mode-lexer.el b/swift-mode-lexer.el
index ab93cae..bcda40e 100644
--- a/swift-mode-lexer.el
+++ b/swift-mode-lexer.el
@@ -463,6 +463,12 @@ Return nil otherwise." ;; FIXME pound-count
                     "fileprivate")))))
       nil)
 
+     ;; Suppress implicit semicolon after declaration starters.
+     ((member (swift-mode:token:text previous-token)
+              '("class" "struct" "protocol" "enum" "extension" "func"
+                "typealias" "associatedtype" "precedencegroup" "operator"))
+      nil)
+
      ;; Insert implicit semicolon before modifiers.
      ;;
      ;; Preceding modifiers takes precedence over this.
@@ -525,12 +531,6 @@ Return nil otherwise." ;; FIXME pound-count
               '("get" "set" "willSet" "didSet" "subscript" "init" "deinit"))
       t)
 
-     ;; Suppress implicit semicolon after declaration starters.
-     ((member (swift-mode:token:text previous-token)
-              '("class" "struct" "protocol" "enum" "extension" "func"
-                "typealias" "associatedtype" "precedencegroup" "operator"))
-      nil)
-
      ;; Inserts implicit semicolon before declaration starters.
      ;; Modifiers take precedence over this.
      ;;
diff --git a/test/swift-files/indent/declarations.swift 
b/test/swift-files/indent/declarations.swift
index 7ad7978..469d0f9 100644
--- a/test/swift-files/indent/declarations.swift
+++ b/test/swift-files/indent/declarations.swift
@@ -460,3 +460,59 @@ precedencegroup
     associativity:
       left
 }
+
+// Declaration modifiers
+
+class Foo {
+    open
+      class
+      mutating
+      nonmutating
+      func
+      foo() {
+    }
+
+    public
+      (
+        set
+      )
+      class
+      dynamic
+      final
+      lazy
+      optional
+      required
+      static
+      unowned
+      unowned
+      (
+        safe
+      )
+      unowned
+      (
+        unsafe
+      )
+      weak
+      var
+      x = 1
+
+    internal
+      class
+      let
+      x = 1
+
+    fileprivate
+      class
+      init() {
+    }
+
+    private
+      class
+      deinit {
+    }
+
+    class
+      subscript(foo: Int) -> Int {
+        return foo
+    }
+}



reply via email to

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