Skip to content

[NFC][Parse] Remove unused HandleCodeCompletion param in parseType() #34529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions include/swift/Parse/Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -1176,15 +1176,12 @@ class Parser {

ParserResult<TypeRepr> parseType();
ParserResult<TypeRepr> parseType(Diag<> MessageID,
bool HandleCodeCompletion = true,
bool IsSILFuncDecl = false);

ParserResult<TypeRepr>
parseTypeSimpleOrComposition(Diag<> MessageID,
bool HandleCodeCompletion = true);
parseTypeSimpleOrComposition(Diag<> MessageID);

ParserResult<TypeRepr> parseTypeSimple(Diag<> MessageID,
bool HandleCodeCompletion = true);
ParserResult<TypeRepr> parseTypeSimple(Diag<> MessageID);

/// Parse layout constraint.
LayoutConstraint parseLayoutConstraint(Identifier LayoutConstraintID);
Expand Down
17 changes: 5 additions & 12 deletions lib/Parse/ParseType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ LayoutConstraint Parser::parseLayoutConstraint(Identifier LayoutConstraintID) {
/// type-simple '!'
/// type-collection
/// type-array
ParserResult<TypeRepr> Parser::parseTypeSimple(Diag<> MessageID,
bool HandleCodeCompletion) {
ParserResult<TypeRepr> Parser::parseTypeSimple(Diag<> MessageID) {
ParserResult<TypeRepr> ty;

if (Tok.is(tok::kw_inout) ||
Expand All @@ -175,8 +174,6 @@ ParserResult<TypeRepr> Parser::parseTypeSimple(Diag<> MessageID,
ty = parseTypeTupleBody();
break;
case tok::code_complete:
if (!HandleCodeCompletion)
break;
if (CodeCompletion)
CodeCompletion->completeTypeSimpleBeginning();
return makeParserCodeCompletionResult<TypeRepr>(
Expand Down Expand Up @@ -358,7 +355,6 @@ ParserResult<TypeRepr> Parser::parseSILBoxType(GenericParamList *generics,
/// type-composition 'async'? 'throws'? '->' type
///
ParserResult<TypeRepr> Parser::parseType(Diag<> MessageID,
bool HandleCodeCompletion,
bool IsSILFuncDecl) {
// Start a context for creating type syntax.
SyntaxParsingContext TypeParsingContext(SyntaxContext,
Expand Down Expand Up @@ -404,8 +400,7 @@ ParserResult<TypeRepr> Parser::parseType(Diag<> MessageID,
return parseSILBoxType(generics, attrs, GenericsScope);
}

ParserResult<TypeRepr> ty =
parseTypeSimpleOrComposition(MessageID, HandleCodeCompletion);
ParserResult<TypeRepr> ty = parseTypeSimpleOrComposition(MessageID);
if (ty.isNull())
return ty;
auto tyR = ty.get();
Expand Down Expand Up @@ -834,8 +829,7 @@ Parser::parseTypeIdentifier(bool isParsingQualifiedDeclBaseType) {
/// 'some'? type-simple
/// type-composition '&' type-simple
ParserResult<TypeRepr>
Parser::parseTypeSimpleOrComposition(Diag<> MessageID,
bool HandleCodeCompletion) {
Parser::parseTypeSimpleOrComposition(Diag<> MessageID) {
SyntaxParsingContext SomeTypeContext(SyntaxContext, SyntaxKind::SomeType);
// Check for the opaque modifier.
// This is only semantically allowed in certain contexts, but we parse it
Expand All @@ -859,8 +853,7 @@ Parser::parseTypeSimpleOrComposition(Diag<> MessageID,

SyntaxParsingContext CompositionContext(SyntaxContext, SyntaxContextKind::Type);
// Parse the first type
ParserResult<TypeRepr> FirstType = parseTypeSimple(MessageID,
HandleCodeCompletion);
ParserResult<TypeRepr> FirstType = parseTypeSimple(MessageID);
if (FirstType.isNull())
return FirstType;
if (!Tok.isContextualPunctuator("&")) {
Expand Down Expand Up @@ -918,7 +911,7 @@ Parser::parseTypeSimpleOrComposition(Diag<> MessageID,

// Parse next type.
ParserResult<TypeRepr> ty =
parseTypeSimple(diag::expected_identifier_for_type, HandleCodeCompletion);
parseTypeSimple(diag::expected_identifier_for_type);
if (ty.hasCodeCompletion())
return makeParserCodeCompletionResult<TypeRepr>();
Status |= ty;
Expand Down
1 change: 0 additions & 1 deletion lib/SIL/Parser/ParseSIL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,6 @@ bool SILParser::parseSILType(SILType &Result,
}

ParserResult<TypeRepr> TyR = P.parseType(diag::expected_sil_type,
/*handleCodeCompletion*/ true,
/*isSILFuncDecl*/ IsFuncDecl);

if (TyR.isNull())
Expand Down