Avatar
omochimetaru 1/20/2019 7:49 AM
できた!!
👀 1
7:49 AM
ちょいまちよ
7:50 AM
let sourceFile = try SyntaxTreeParser.parse(codePath) let blocks = sourceFile.children.compactMap { $0 as? CodeBlockItemListSyntax }.first! let block: CodeBlockItemSyntax = blocks.first! let classDecl = block.children.compactMap { $0 as? ClassDeclSyntax }.first! let funcDecl = classDecl.members.members.children.compactMap { $0 as? FunctionDeclSyntax }.first! let funcSig = funcDecl.children.compactMap { $0 as? FunctionSignatureSyntax }.first! let paramClause = funcSig.children.compactMap { $0 as? ParameterClauseSyntax }.first! let params = paramClause.children.compactMap { $0 as? FunctionParameterListSyntax }.first! let param0: FunctionParameterSyntax = params[0] print(param0) if let ellipsis = param0.ellipsis { print("---ellipsis---") print(type(of: ellipsis)) print(ellipsis) print("---") } else { print("no ellipsis") } if let trailingComma = param0.trailingComma { print("---trailing comma---") print(type(of: trailingComma)) print(trailingComma) print("---") } else { print("no trailing comma") }
7:50 AM
ccc: Int, ---ellipsis--- TokenSyntax , --- no trailing comma Program ended with exit code: 0
7:50 AM
ellipsis扱いで , が来て、 trailing commaが無いことになった。
7:52 AM
Contribute to omochi/SwiftSyntax-issue-ellipsis development by creating an account on GitHub.