Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 592215e

Browse files
authored
Merge pull request #48 from abeaumont/fix/switch-statement-roles
Fix switch statement annotations
2 parents 3984d57 + e5cca83 commit 592215e

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

ANNOTATION.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@
6565
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='IfStatement'\]/\*\[@internalRole\]\[@internalRole='elseStatement'\] | If, Else, Body |
6666
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='SwitchStatement'\] | Statement, Switch |
6767
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='SwitchStatement'\]/\*\[@internalRole\]\[@internalRole='expression'\] | Expression, Switch |
68-
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='SwitchStatement'\]/\*\[@InternalType='SwitchCase'\] | Statement, Switch, Case |
69-
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='SwitchStatement'\]/\*\[@InternalType='SwitchCase'\]/self::\*\[child::\*\] | Switch, Case |
68+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='SwitchStatement'\]/\*\[@InternalType='SwitchCase'\] | Statement, Switch |
69+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='SwitchStatement'\]/\*\[@InternalType='SwitchCase'\]/self::\*\[child::\*\] | Case |
7070
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='SwitchStatement'\]/\*\[@InternalType='SwitchCase'\]/self::\*\[child::\*\]/\*\[@internalRole\]\[@internalRole='expression'\] | Expression, Switch, Case, Condition |
71-
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='SwitchStatement'\]/\*\[@InternalType='SwitchCase'\]/self::\*\[not\(child::\*\)\] | Switch, Default |
71+
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='SwitchStatement'\]/\*\[@InternalType='SwitchCase'\]/self::\*\[not\(child::\*\)\] | Default |
7272
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='SwitchStatement'\]/\*\[@InternalType='ExpressionStatement'\] | Switch, Case, Body |
7373
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='EnhancedForStatement'\] | Statement, For, Iterator |
7474
| /self::\*\[@InternalType='CompilationUnit'\]//\*\[@InternalType='EnhancedForStatement'\]/\*\[@internalRole\]\[@internalRole='parameter'\] | For, Iterator |

driver/normalizer/annotation.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,11 @@ var AnnotationRules = On(jdt.CompilationUnit).Roles(uast.File).Descendants(
116116

117117
On(jdt.SwitchStatement).Roles(uast.Statement, uast.Switch).Children(
118118
On(jdt.PropertyExpression).Roles(uast.Expression, uast.Switch),
119-
On(jdt.SwitchCase).Roles(uast.Statement, uast.Switch, uast.Case).Self(
120-
On(HasChild(Any)).Roles(uast.Switch, uast.Case).Children(
119+
On(jdt.SwitchCase).Roles(uast.Statement, uast.Switch).Self(
120+
On(HasChild(Any)).Roles(uast.Case).Children(
121121
On(jdt.PropertyExpression).Roles(uast.Expression, uast.Switch, uast.Case, uast.Condition),
122122
),
123-
On(Not(HasChild(Any))).Roles(uast.Switch, uast.Default),
123+
On(Not(HasChild(Any))).Roles(uast.Default),
124124
),
125125
// FIXME: Switch case bodies are not enclosed in a block, thus it may
126126
// contain an arbitrary number of statements (of any kind). So this

tests/switch.uast

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ CompilationUnit {
119119
. . . . . . . . . . . }
120120
. . . . . . . . . . }
121121
. . . . . . . . . . 1: SwitchCase {
122-
. . . . . . . . . . . Roles: Statement,Switch,Case,Switch,Case
122+
. . . . . . . . . . . Roles: Statement,Switch,Case
123123
. . . . . . . . . . . Properties: {
124124
. . . . . . . . . . . . internalRole: statements
125125
. . . . . . . . . . . }
@@ -236,7 +236,7 @@ CompilationUnit {
236236
. . . . . . . . . . . }
237237
. . . . . . . . . . }
238238
. . . . . . . . . . 3: SwitchCase {
239-
. . . . . . . . . . . Roles: Statement,Switch,Case,Switch,Case
239+
. . . . . . . . . . . Roles: Statement,Switch,Case
240240
. . . . . . . . . . . Properties: {
241241
. . . . . . . . . . . . internalRole: statements
242242
. . . . . . . . . . . }
@@ -353,7 +353,7 @@ CompilationUnit {
353353
. . . . . . . . . . . }
354354
. . . . . . . . . . }
355355
. . . . . . . . . . 5: SwitchCase {
356-
. . . . . . . . . . . Roles: Statement,Switch,Case,Switch,Case
356+
. . . . . . . . . . . Roles: Statement,Switch,Case
357357
. . . . . . . . . . . Properties: {
358358
. . . . . . . . . . . . internalRole: statements
359359
. . . . . . . . . . . }
@@ -580,7 +580,7 @@ CompilationUnit {
580580
. . . . . . . . . . . }
581581
. . . . . . . . . . }
582582
. . . . . . . . . . 11: SwitchCase {
583-
. . . . . . . . . . . Roles: Statement,Switch,Case,Switch,Default
583+
. . . . . . . . . . . Roles: Statement,Switch,Default
584584
. . . . . . . . . . . Properties: {
585585
. . . . . . . . . . . . internalRole: statements
586586
. . . . . . . . . . . }

0 commit comments

Comments
 (0)