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
66
77let x2 : a & b [ 1 ]
88// 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 {
111111 : IsMissing(IsMissing), TokenKind(TokenKind),
112112 LeadingTrivia (LeadingTrivia), TrailingTrivia(TrailingTrivia),
113113 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+ }
114124};
115125
116126struct DeferredLayoutNode {
@@ -272,7 +282,7 @@ class CLibParseActions final : public SyntaxParseActions {
272282 break ;
273283 case RecordedOrDeferredNode::Kind::DeferredToken:
274284 length += static_cast <const DeferredTokenNode *>(child.getOpaque ())
275- ->Range . getByteLength ();
285+ ->getLength ();
276286 break ;
277287 }
278288 }
@@ -373,7 +383,7 @@ class CLibParseActions final : public SyntaxParseActions {
373383 case RecordedOrDeferredNode::Kind::DeferredToken:
374384 StartLoc = StartLoc.getAdvancedLoc (
375385 static_cast <const DeferredTokenNode *>(Child.getOpaque ())
376- ->Range . getByteLength ());
386+ ->getLength ());
377387 break ;
378388 }
379389 }
You can’t perform that action at this time.
0 commit comments