Skip to content

Commit 668fa1d

Browse files
committed
[ParsedRawSyntaxNode] Fix ParsedRawSyntaxNode::dump()
Using dumpTokenKind() function instead of getTokenText().
1 parent 9e67e73 commit 668fa1d

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

include/swift/Syntax/TokenKinds.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ bool isTokenTextDetermined(tok kind);
3131

3232
/// If a token kind has determined text, return the text; otherwise assert.
3333
StringRef getTokenText(tok kind);
34+
35+
void dumpTokenKind(llvm::raw_ostream &os, tok kind);
3436
} // end namespace swift
3537

3638
#endif // SWIFT_TOKENKINDS_H

lib/Parse/ParsedRawSyntaxNode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ void ParsedRawSyntaxNode::dump(llvm::raw_ostream &OS, unsigned Indent) const {
4848
dumpSyntaxKind(OS, getKind());
4949

5050
if (isToken()) {
51-
OS << ' ' << getTokenText(getTokenKind());
51+
dumpTokenKind(OS, getTokenKind());
5252

5353
} else {
5454
if (isRecorded()) {

lib/Syntax/RawSyntax.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ static void printSyntaxKind(SyntaxKind Kind, llvm::raw_ostream &OS,
5252
OS << ">";
5353
}
5454

55-
static void dumpTokenKind(llvm::raw_ostream &OS, tok Kind) {
55+
} // end of anonymous namespace
56+
57+
void swift::dumpTokenKind(llvm::raw_ostream &OS, tok Kind) {
5658
switch (Kind) {
5759
#define TOKEN(X) \
5860
case tok::X: \
@@ -65,8 +67,6 @@ static void dumpTokenKind(llvm::raw_ostream &OS, tok Kind) {
6567
}
6668
}
6769

68-
} // end of anonymous namespace
69-
7070
unsigned RawSyntax::NextFreeNodeId = 1;
7171

7272
RawSyntax::RawSyntax(SyntaxKind Kind, ArrayRef<RC<RawSyntax>> Layout,

0 commit comments

Comments
 (0)