[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode 1178d72a37 5/9: Add init accessors
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode 1178d72a37 5/9: Add init accessors |
Date: |
Sat, 30 Sep 2023 07:01:19 -0400 (EDT) |
branch: elpa/swift-mode
commit 1178d72a3799639026f889cf0a1782b8e8cbd2a1
Author: taku0 <mxxouy6x3m_github@tatapa.org>
Commit: taku0 <mxxouy6x3m_github@tatapa.org>
Add init accessors
https://github.com/apple/swift-evolution/blob/main/proposals/0400-init-accessors.md
---
swift-mode-beginning-of-defun.el | 5 +--
.../beginning-of-defun/beginning-of-defun.swift | 18 +++++-----
test/swift-files/indent/declarations.swift | 40 ++++++++++++++++++++++
3 files changed, 52 insertions(+), 11 deletions(-)
diff --git a/swift-mode-beginning-of-defun.el b/swift-mode-beginning-of-defun.el
index 399d4f24e9..7b99f075e2 100644
--- a/swift-mode-beginning-of-defun.el
+++ b/swift-mode-beginning-of-defun.el
@@ -24,7 +24,7 @@
;; `beginning-of-defun' and `end-of-defun'
;;
;; A defun is a declaration except local variable, "get", "set", "willSet",
-;; "didSet", or "case" within enum.
+;; "didSet", "case" within enum, or "init" within var.
;;
;; A defun include modifiers, attributes, and comments on the same line.
;;
@@ -1417,7 +1417,8 @@ of ancestors."
(when (eq (swift-mode:token:type next-token) 'identifier)
next-token))))
name-tokens)
- '()))))
+ (swift-mode:backward-sexps-until-open-curly-bracket)
+ (swift-mode:current-defun-name-token-list)))))
(defun swift-mode:current-defun-name-token ()
"Return the name token of the defun under the point."
diff --git a/test/swift-files/beginning-of-defun/beginning-of-defun.swift
b/test/swift-files/beginning-of-defun/beginning-of-defun.swift
index b23fbefc24..01a5a327be 100644
--- a/test/swift-files/beginning-of-defun/beginning-of-defun.swift
+++ b/test/swift-files/beginning-of-defun/beginning-of-defun.swift
@@ -166,17 +166,17 @@ foo() {
/*{*/enum Foo<A> where A: B {
/*{*/case Foo(a: Int)/*}*/
/*{*/case Bar(b: Int), Baz/*}*/
- /*{*/case
- A(
- b
- :
- Int)
- ,
- @Foo
+ /*{*/@Foo
indirect
+ case
+ A(
+ b
+ :
+ Int)
+ ,
B
- =
- 0/*}*/
+ =
+ 0/*}*/
/*{*/func foo() -> a {
/*[*/switch this {
diff --git a/test/swift-files/indent/declarations.swift
b/test/swift-files/indent/declarations.swift
index 93caf11b10..2adef2a3b7 100644
--- a/test/swift-files/indent/declarations.swift
+++ b/test/swift-files/indent/declarations.swift
@@ -220,6 +220,10 @@ class Foo {
}
var x {
+ init {
+ x = 1
+ }
+
get {
1
}
@@ -230,6 +234,11 @@ class Foo {
}
var x {
+ init
+ {
+ x = 1
+ }
+
get
{
1
@@ -241,6 +250,37 @@ class Foo {
}
}
+ var x {
+ init(newValue) {
+ x = 1
+ }
+
+ get {
+ 1
+ }
+
+ set(newValue) {
+ foo()
+ }
+ }
+
+ var x {
+ init(newValue)
+ {
+ x = 1
+ }
+
+ get
+ {
+ 1
+ }
+
+ set(newValue)
+ {
+ foo()
+ }
+ }
+
var x {
get
async
- [nongnu] elpa/swift-mode updated (2b2e8581ba -> e58417ec87), ELPA Syncer, 2023/09/30
- [nongnu] elpa/swift-mode 6194d9578d 2/9: Add `borrowing` and `consuming` modifiers and `copy` operator, ELPA Syncer, 2023/09/30
- [nongnu] elpa/swift-mode 221863c4e2 1/9: Add `consume` operator, ELPA Syncer, 2023/09/30
- [nongnu] elpa/swift-mode 6b19157def 3/9: Add `package` modifier, ELPA Syncer, 2023/09/30
- [nongnu] elpa/swift-mode 1339e24d23 4/9: Add `discard self`, ELPA Syncer, 2023/09/30
- [nongnu] elpa/swift-mode 1178d72a37 5/9: Add init accessors,
ELPA Syncer <=
- [nongnu] elpa/swift-mode ef36acf2c5 6/9: Add value and type parameter packs, ELPA Syncer, 2023/09/30
- [nongnu] elpa/swift-mode a22f053c2b 7/9: Add macro declaration, ELPA Syncer, 2023/09/30
- [nongnu] elpa/swift-mode 73d20b686f 8/9: Open .swiftinterface files in Swift mode, ELPA Syncer, 2023/09/30
- [nongnu] elpa/swift-mode e58417ec87 9/9: Bump version to 9.1.0, ELPA Syncer, 2023/09/30