@@ -50,14 +50,14 @@ public static File ParseCore(string filePath, CharacterPositionFinder finder, En
50
50
51
51
foreach ( var child in rootNode . Children . Where ( _ => _ . Kind != SyntaxKind . EndOfFileToken ) )
52
52
{
53
- var node = ParseNode ( child , finder ) ;
53
+ var node = ParseNodeForType ( child , finder ) ;
54
54
file . Children . Add ( node ) ;
55
55
}
56
56
57
57
return file ;
58
58
}
59
59
60
- private static ContainerOrTerminalNode ParseNode ( Node node , CharacterPositionFinder finder )
60
+ private static ContainerOrTerminalNode ParseNodeForType ( Node node , CharacterPositionFinder finder )
61
61
{
62
62
switch ( node )
63
63
{
@@ -82,6 +82,32 @@ private static ContainerOrTerminalNode ParseNode(Node node, CharacterPositionFin
82
82
}
83
83
}
84
84
85
+ private static ContainerOrTerminalNode ParseNodeForKind ( Node node , CharacterPositionFinder finder )
86
+ {
87
+ switch ( node . Kind )
88
+ {
89
+ case SyntaxKind . EndOfFileToken :
90
+ case SyntaxKind . Identifier :
91
+ case SyntaxKind . ExportKeyword :
92
+ case SyntaxKind . HeritageClause :
93
+ case SyntaxKind . Decorator :
94
+ return null ;
95
+
96
+ case SyntaxKind . GetAccessor :
97
+ case SyntaxKind . SetAccessor :
98
+ case SyntaxKind . Constructor :
99
+ case SyntaxKind . PropertyDeclaration :
100
+ case SyntaxKind . MethodDeclaration :
101
+ {
102
+ return ParseTerminalNode ( node , finder ) ;
103
+ }
104
+
105
+ default :
106
+ Tracer . Trace ( $ "Cannot handle '{ node . Kind } '") ;
107
+ return null ;
108
+ }
109
+ }
110
+
85
111
private static ContainerOrTerminalNode ParseClassDeclaration ( ClassDeclaration node , CharacterPositionFinder finder )
86
112
{
87
113
var headerSpan = GetHeaderSpan ( node , finder ) ;
@@ -98,27 +124,10 @@ private static ContainerOrTerminalNode ParseClassDeclaration(ClassDeclaration no
98
124
99
125
foreach ( var child in node . Children )
100
126
{
101
- switch ( child . Kind )
127
+ var item = ParseNodeForKind ( child , finder ) ;
128
+ if ( item != null )
102
129
{
103
- case SyntaxKind . EndOfFileToken :
104
- case SyntaxKind . Identifier :
105
- case SyntaxKind . ExportKeyword :
106
- case SyntaxKind . HeritageClause :
107
- case SyntaxKind . Decorator :
108
- continue ;
109
-
110
- case SyntaxKind . Constructor :
111
- case SyntaxKind . PropertyDeclaration :
112
- case SyntaxKind . MethodDeclaration :
113
- {
114
- var item = ParseTerminalNode ( child , finder ) ;
115
- container . Children . Add ( item ) ;
116
- continue ;
117
- }
118
-
119
- default :
120
- Tracer . Trace ( $ "Cannot handle '{ child . Kind } '") ;
121
- continue ;
130
+ container . Children . Add ( item ) ;
122
131
}
123
132
}
124
133
@@ -259,7 +268,7 @@ private static ContainerOrTerminalNode ParseDescribeTestExpression(CallExpressio
259
268
}
260
269
261
270
default :
262
- Tracer . Trace ( $ "Cannot handle '{ child . Kind } '") ;
271
+ Tracer . Trace ( $ "Cannot handle '{ child . Kind } '") ; // TODO RKN: GetAccessor
263
272
break ;
264
273
}
265
274
}
@@ -359,6 +368,9 @@ private static string GetType(Node node)
359
368
case SyntaxKind . MethodDeclaration : return "method" ;
360
369
case SyntaxKind . PropertyDeclaration : return "property" ;
361
370
case SyntaxKind . VariableDeclaration : return node . Parent . Flags == NodeFlags . Const ? "const" : "variable" ;
371
+ case SyntaxKind . GetAccessor : return "getter" ;
372
+ case SyntaxKind . SetAccessor : return "setter" ;
373
+
362
374
default :
363
375
return kind . ToString ( ) ;
364
376
}
0 commit comments