File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
tools/libSwiftSyntaxParser Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -6,3 +6,6 @@ let x: a[i] & b
6
6
7
7
let x2 : a & b [ 1 ]
8
8
// CHECK: |x2|
9
+
10
+ let x3 : ( A -> B )
11
+ // CHECK: |x3|
Original file line number Diff line number Diff line change @@ -111,6 +111,16 @@ struct DeferredTokenNode {
111
111
: IsMissing(IsMissing), TokenKind(TokenKind),
112
112
LeadingTrivia (LeadingTrivia), TrailingTrivia(TrailingTrivia),
113
113
Range(Range) {}
114
+
115
+ // / Returns the length of this token or \c 0 if the token is missing.
116
+ size_t getLength () const {
117
+ if (IsMissing) {
118
+ return 0 ;
119
+ } else {
120
+ assert (Range.isValid ());
121
+ return Range.getByteLength ();
122
+ }
123
+ }
114
124
};
115
125
116
126
struct DeferredLayoutNode {
@@ -272,7 +282,7 @@ class CLibParseActions final : public SyntaxParseActions {
272
282
break ;
273
283
case RecordedOrDeferredNode::Kind::DeferredToken:
274
284
length += static_cast <const DeferredTokenNode *>(child.getOpaque ())
275
- ->Range . getByteLength ();
285
+ ->getLength ();
276
286
break ;
277
287
}
278
288
}
@@ -373,7 +383,7 @@ class CLibParseActions final : public SyntaxParseActions {
373
383
case RecordedOrDeferredNode::Kind::DeferredToken:
374
384
StartLoc = StartLoc.getAdvancedLoc (
375
385
static_cast <const DeferredTokenNode *>(Child.getOpaque ())
376
- ->Range . getByteLength ());
386
+ ->getLength ());
377
387
break ;
378
388
}
379
389
}
You can’t perform that action at this time.
0 commit comments