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

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

[nongnu] elpa/swift-mode c38b721 216/496: Support default values for arg


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode c38b721 216/496: Support default values for arguments in function declaration
Date: Sun, 29 Aug 2021 11:33:38 -0400 (EDT)

branch: elpa/swift-mode
commit c38b7216abf97bb5496992974acfbf5189c90b3c
Author: ap4y <lod@pisem.net>
Commit: ap4y <lod@pisem.net>

    Support default values for arguments in function declaration
---
 swift-mode.el             | 2 +-
 test/indentation-tests.el | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/swift-mode.el b/swift-mode.el
index ae06f79..41b7689 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -117,7 +117,7 @@
        (func-decl ("DECSPEC" "func" func-header)
                   (func-decl "->" type))
        (func-header (id "(" func-params ")"))
-       (func-param (decl-exp) ("..."))
+       (func-param (decl-exp) (decl-exp "=" id) ("..."))
        (func-params (func-param "," func-param))
 
        (insts (inst) (insts ";" insts))
diff --git a/test/indentation-tests.el b/test/indentation-tests.el
index a395291..3bb1623 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -846,6 +846,15 @@ func foo() ->
     |[A] {}
 ")
 
+(check-indentation indents-func-declaration/10
+                   "
+func a(a: NSString = 1,
+                     |b: NSString = 2) {}
+" "
+func a(a: NSString = 1,
+       |b: NSString = 2) {}
+")
+
 (check-indentation indents-protocol-declaration/1
                    "
 protocol Foo {



reply via email to

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