@@ -157,10 +157,6 @@ LayoutConstraint Parser::parseLayoutConstraint(Identifier LayoutConstraintID) {
157
157
alignment, Context);
158
158
}
159
159
160
- ParserResult<TypeRepr> Parser::parseTypeSimple () {
161
- return parseTypeSimple (diag::expected_type);
162
- }
163
-
164
160
// / parseTypeSimple
165
161
// / type-simple:
166
162
// / type-identifier
@@ -176,22 +172,14 @@ ParserResult<TypeRepr> Parser::parseTypeSimple() {
176
172
ParserResult<TypeRepr> Parser::parseTypeSimple (Diag<> MessageID,
177
173
bool HandleCodeCompletion) {
178
174
ParserResult<TypeRepr> ty;
179
- // If this is an "inout" marker for an identifier type, consume the inout.
180
- SourceLoc SpecifierLoc;
181
- VarDecl::Specifier TypeSpecifier;
182
- if (Tok.is (tok::kw_inout)) {
183
- SpecifierLoc = consumeToken ();
184
- TypeSpecifier = VarDecl::Specifier::InOut;
185
- } else if (Tok.is (tok::identifier)) {
186
- if (Tok.getRawText ().equals (" __shared" )) {
187
- assert (false );
188
- SpecifierLoc = consumeToken ();
189
- TypeSpecifier = VarDecl::Specifier::Shared;
190
- } else if (Tok.getRawText ().equals (" __owned" )) {
191
- assert (false );
192
- SpecifierLoc = consumeToken ();
193
- TypeSpecifier = VarDecl::Specifier::Owned;
194
- }
175
+
176
+ if (Tok.is (tok::kw_inout) ||
177
+ (Tok.is (tok::identifier) && (Tok.getRawText ().equals (" __shared" ) ||
178
+ Tok.getRawText ().equals (" __owned" )))) {
179
+ // Type specifier should already be parsed before here. This only happens
180
+ // for construct like 'P1 & inout P2'.
181
+ diagnose (Tok.getLoc (), diag::attr_only_on_parameters_parse, Tok.getText ());
182
+ consumeToken ();
195
183
}
196
184
197
185
switch (Tok.getKind ()) {
@@ -301,24 +289,6 @@ ParserResult<TypeRepr> Parser::parseTypeSimple(Diag<> MessageID,
301
289
break ;
302
290
}
303
291
304
- // If we parsed any specifier, prepend it.
305
- if (SpecifierLoc.isValid () && ty.isNonNull ()) {
306
- TypeRepr *repr = ty.get ();
307
- switch (TypeSpecifier) {
308
- case VarDecl::Specifier::InOut:
309
- repr = new (Context) InOutTypeRepr (repr, SpecifierLoc);
310
- break ;
311
- case VarDecl::Specifier::Shared:
312
- repr = new (Context) SharedTypeRepr (repr, SpecifierLoc);
313
- break ;
314
- case VarDecl::Specifier::Owned:
315
- break ;
316
- case VarDecl::Specifier::Var:
317
- llvm_unreachable (" tried to create var type specifier?" );
318
- }
319
- ty = makeParserResult (repr);
320
- }
321
-
322
292
return ty;
323
293
}
324
294
@@ -677,10 +647,6 @@ SyntaxParserResult<TypeSyntax, TypeRepr> Parser::parseTypeIdentifier() {
677
647
return makeSyntaxResult (Status, SyntaxNode, ITR);
678
648
}
679
649
680
- ParserResult<TypeRepr> Parser::parseTypeSimpleOrComposition () {
681
- return parseTypeSimpleOrComposition (diag::expected_identifier_for_type);
682
- }
683
-
684
650
// / parseTypeSimpleOrComposition
685
651
// /
686
652
// / type-composition:
0 commit comments