-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
compilerThe Swift compiler itselfThe Swift compiler itselfdeclarationsFeature: declarationsFeature: declarationsextensionFeature → declarations: `extension` declarationsFeature → declarations: `extension` declarationsparserArea → compiler: The legacy C++ parserArea → compiler: The legacy C++ parser† libswiftSyntaxArchive • Area → compiler: the once-integrated C++ Syntax library succeeded by SwiftSyntaxArchive • Area → compiler: the once-integrated C++ Syntax library succeeded by SwiftSyntax
Description
| Previous ID | SR-6572 |
| Radar | None |
| Original Reporter | @nkcsgexi |
| Type | Task |
| Status | Resolved |
| Resolution | Done |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Source Tooling |
| Labels | Task |
| Assignee | sigito (JIRA) |
| Priority | Medium |
md5: 0c91fdc7ba3ed9ea78b10c4bea2ed8fd
Issue Description:
Currently, libSyntax parsing doesn't specialize extension declarations, meaning all extension declarations are manifested as UnkownDecl. Since libSyntax clients will very likely interested in specialized analysis on extensions. We need to teach the parser to specialize them.
To demo what we have now:
$cat ~/Desktop/test.swift
extension C{}
func foo() {}
$../build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swift-syntax-test -input-source-filename ~/Desktop/test.swift -parse-gen -print-node-kind -print-trivial-node-kind
<SourceFile><DeclList><TopLevelCodeDecl><StmtList><DeclarationStmt><UnknownDecl>extension <SimpleTypeIdentifier>C</SimpleTypeIdentifier>{<DeclList></DeclList>}</UnknownDecl></DeclarationStmt><DeclarationStmt><FunctionDecl>
func foo<FunctionSignature>(<FunctionParameterList></FunctionParameterList>) </FunctionSignature><CodeBlock>{<StmtList></StmtList>}</CodeBlock></FunctionDecl></DeclarationStmt></StmtList></TopLevelCodeDecl></DeclList>
</SourceFile>See that the function decl is specialized however the extension decl is not. The desirable feature will be having extension decls specialized as well. One can follow the patch we specialized struct declaration from: c4604d7
Metadata
Metadata
Assignees
Labels
compilerThe Swift compiler itselfThe Swift compiler itselfdeclarationsFeature: declarationsFeature: declarationsextensionFeature → declarations: `extension` declarationsFeature → declarations: `extension` declarationsparserArea → compiler: The legacy C++ parserArea → compiler: The legacy C++ parser† libswiftSyntaxArchive • Area → compiler: the once-integrated C++ Syntax library succeeded by SwiftSyntaxArchive • Area → compiler: the once-integrated C++ Syntax library succeeded by SwiftSyntax