Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-6917] Implement SwitchStmtSyntax #49466

Closed
dabrahams opened this issue Feb 3, 2018 · 5 comments
Closed

[SR-6917] Implement SwitchStmtSyntax #49466

dabrahams opened this issue Feb 3, 2018 · 5 comments
Assignees
Labels
compiler The Swift compiler in itself † libswiftSyntax † Area → compiler: the once-integrated C++ Syntax library succeeded by SwiftSyntax switch Feature → statements: 'switch' statements task

Comments

@dabrahams
Copy link
Collaborator

Previous ID SR-6917
Radar None
Original Reporter @dabrahams
Type Task
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Source Tooling
Labels Task, Syntax
Assignee @rintaro
Priority Medium

md5: 1030482802c119fb302eac762ffcb592

Issue Description:

Here's a switch statement being visited with the stack of syntax nodes to the right of each token. You can see that SwitchStmtSyntax never appears:

         switch          [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
         c       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, IdentifierExpr]
         {       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
         case        [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
         0xb         [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, IntegerLiteralExpr]
         ,       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
         0xc         [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, IntegerLiteralExpr]
         :       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
         line        [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, IdentifierExpr]
         +=          [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, BinaryOperatorExpr]
         1       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, IntegerLiteralExpr]
         case        [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
         "\n"        [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, MemberAccessExpr, MemberAccessExpr, StringLiteralExpr]
             .       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, MemberAccessExpr, MemberAccessExpr]
             utf16       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, MemberAccessExpr, MemberAccessExpr]
             .       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, MemberAccessExpr]
             first       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, MemberAccessExpr]
         :       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
         line        [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, UnknownStmt, SequenceExpr, IdentifierExpr]
         +=          [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, UnknownStmt, SequenceExpr, BinaryOperatorExpr]
         1       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, UnknownStmt, SequenceExpr, IntegerLiteralExpr]
         ;       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, UnknownStmt]
         column          [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, IdentifierExpr]
         =       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, AssignmentExpr]
         0       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, IntegerLiteralExpr]
         case        [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
         "\r"        [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, MemberAccessExpr, MemberAccessExpr, StringLiteralExpr]
             .       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, MemberAccessExpr, MemberAccessExpr]
             utf16       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, MemberAccessExpr, MemberAccessExpr]
             .       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, MemberAccessExpr]
             first       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionPattern, MemberAccessExpr]
         :       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
         column          [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, IdentifierExpr]
         =       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, AssignmentExpr]
         0       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, IntegerLiteralExpr]
         default         [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
         :       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
         column          [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, IdentifierExpr]
         +=          [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, BinaryOperatorExpr]
         1       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt, ExpressionStmt, SequenceExpr, IntegerLiteralExpr]
         }       [SourceFile, TopLevelCodeDecl, DeclarationStmt, StructDecl, MemberDeclBlock, FunctionDecl, CodeBlock, ForInStmt, CodeBlock, UnknownStmt]
@belkadan
Copy link
Contributor

belkadan commented Feb 5, 2018

I believe they just haven't gotten to switch yet. cc @nkcsgexi

@nkcsgexi
Copy link
Member

nkcsgexi commented Feb 5, 2018

Switch statement is not implemented yet. You can track the status here: https://github.com/apple/swift/blob/master/lib/Syntax/Status.md

@nkcsgexi
Copy link
Member

nkcsgexi commented Feb 5, 2018

I remember @rintaro mentioned this node before. @rintaro, is this on your queue to implement Switch statement syntax?

@rintaro
Copy link
Mannequin

rintaro mannequin commented Feb 6, 2018

It's on my queue.

@rintaro
Copy link
Mannequin

rintaro mannequin commented Apr 3, 2018

Implemented in #15537

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the compiler The Swift compiler in itself label Jan 25, 2023
@AnthonyLatsis AnthonyLatsis added the switch Feature → statements: 'switch' statements label Apr 5, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself † libswiftSyntax † Area → compiler: the once-integrated C++ Syntax library succeeded by SwiftSyntax switch Feature → statements: 'switch' statements task
Projects
None yet
Development

No branches or pull requests

4 participants