branch: elpa/swift-mode commit c38b7216abf97bb5496992974acfbf5189c90b3c Author: ap4y <l...@pisem.net> Commit: ap4y <l...@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 {