Skip to content

Commit 071eaf3

Browse files
committed
Move function to utils namespace
gcc/rust/ChangeLog: * parse/rust-parse-impl.h (can_tok_start_type): Move function from ... * parse/rust-parse-utils.h (can_tok_start_type): ... to here. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
1 parent 80ce173 commit 071eaf3

File tree

2 files changed

+38
-38
lines changed

2 files changed

+38
-38
lines changed

gcc/rust/parse/rust-parse-impl.h

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -142,43 +142,6 @@ enum binding_powers
142142
LBP_LOWEST = 0
143143
};
144144

145-
/* Returns whether the token can start a type (i.e. there is a valid type
146-
* beginning with the token). */
147-
inline bool
148-
can_tok_start_type (TokenId id)
149-
{
150-
switch (id)
151-
{
152-
case EXCLAM:
153-
case LEFT_SQUARE:
154-
case LEFT_ANGLE:
155-
case UNDERSCORE:
156-
case ASTERISK:
157-
case AMP:
158-
case LIFETIME:
159-
case IDENTIFIER:
160-
case SUPER:
161-
case SELF:
162-
case SELF_ALIAS:
163-
case CRATE:
164-
case DOLLAR_SIGN:
165-
case SCOPE_RESOLUTION:
166-
case LEFT_PAREN:
167-
case FOR:
168-
case ASYNC:
169-
case CONST:
170-
case UNSAFE:
171-
case EXTERN_KW:
172-
case FN_KW:
173-
case IMPL:
174-
case DYN:
175-
case QUESTION_MARK:
176-
return true;
177-
default:
178-
return false;
179-
}
180-
}
181-
182145
/* HACK-y special handling for skipping a right angle token at the end of
183146
* generic arguments.
184147
* Currently, this replaces the "current token" with one that is identical
@@ -12319,7 +12282,7 @@ Parser<ManagedTokenSource>::null_denotation_path (
1231912282
&& (lexer.peek_token (2)->get_id () == COMMA
1232012283
|| (lexer.peek_token (2)->get_id () == COLON
1232112284
&& (lexer.peek_token (4)->get_id () == COMMA
12322-
|| !can_tok_start_type (
12285+
|| !Parse::Utils::can_tok_start_type (
1232312286
lexer.peek_token (3)->get_id ()))));
1232412287

1232512288
/* definitely not a block:

gcc/rust/parse/rust-parse-utils.h

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,43 @@ is_right_angle_tok (TokenId id)
8282
}
8383
}
8484

85+
/* Returns whether the token can start a type (i.e. there is a valid type
86+
* beginning with the token). */
87+
inline bool
88+
can_tok_start_type (TokenId id)
89+
{
90+
switch (id)
91+
{
92+
case EXCLAM:
93+
case LEFT_SQUARE:
94+
case LEFT_ANGLE:
95+
case UNDERSCORE:
96+
case ASTERISK:
97+
case AMP:
98+
case LIFETIME:
99+
case IDENTIFIER:
100+
case SUPER:
101+
case SELF:
102+
case SELF_ALIAS:
103+
case CRATE:
104+
case DOLLAR_SIGN:
105+
case SCOPE_RESOLUTION:
106+
case LEFT_PAREN:
107+
case FOR:
108+
case ASYNC:
109+
case CONST:
110+
case UNSAFE:
111+
case EXTERN_KW:
112+
case FN_KW:
113+
case IMPL:
114+
case DYN:
115+
case QUESTION_MARK:
116+
return true;
117+
default:
118+
return false;
119+
}
120+
}
121+
85122
} // namespace Utils
86123

87124
} // namespace Parse

0 commit comments

Comments
 (0)