Skip to content

Commit c8ead6d

Browse files
committed
[TypeChecker] NFC: Remove obsolete getObjectLiteralParameterType
1 parent 92271e9 commit c8ead6d

File tree

2 files changed

+0
-39
lines changed

2 files changed

+0
-39
lines changed

lib/Sema/TypeChecker.cpp

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -174,42 +174,6 @@ DeclName TypeChecker::getObjectLiteralConstructorName(ASTContext &Context,
174174
llvm_unreachable("unknown literal constructor");
175175
}
176176

177-
/// Return an idealized form of the parameter type of the given
178-
/// object-literal initializer. This removes references to the protocol
179-
/// name from the first argument label, which would be otherwise be
180-
/// redundant when writing out the object-literal syntax:
181-
///
182-
/// #fileLiteral(fileReferenceLiteralResourceName: "hello.jpg")
183-
///
184-
/// Doing this allows us to preserve a nicer (and source-compatible)
185-
/// literal syntax while still giving the initializer a semantically
186-
/// unambiguous name.
187-
Type TypeChecker::getObjectLiteralParameterType(ObjectLiteralExpr *expr,
188-
ConstructorDecl *ctor) {
189-
auto params = ctor->getMethodInterfaceType()
190-
->castTo<FunctionType>()->getParams();
191-
SmallVector<AnyFunctionType::Param, 8> newParams;
192-
newParams.append(params.begin(), params.end());
193-
194-
auto replace = [&](StringRef replacement) -> Type {
195-
auto &Context = ctor->getASTContext();
196-
newParams[0] = AnyFunctionType::Param(newParams[0].getPlainType(),
197-
Context.getIdentifier(replacement),
198-
newParams[0].getParameterFlags());
199-
return AnyFunctionType::composeInput(Context, newParams,
200-
/*canonicalVararg=*/false);
201-
};
202-
203-
switch (expr->getLiteralKind()) {
204-
case ObjectLiteralExpr::colorLiteral:
205-
return replace("red");
206-
case ObjectLiteralExpr::fileLiteral:
207-
case ObjectLiteralExpr::imageLiteral:
208-
return replace("resourceName");
209-
}
210-
llvm_unreachable("unknown literal constructor");
211-
}
212-
213177
ModuleDecl *TypeChecker::getStdlibModule(const DeclContext *dc) {
214178
if (auto *stdlib = dc->getASTContext().getStdlibModule()) {
215179
return stdlib;

lib/Sema/TypeChecker.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,9 +1057,6 @@ ProtocolDecl *getLiteralProtocol(ASTContext &ctx, Expr *expr);
10571057
DeclName getObjectLiteralConstructorName(ASTContext &ctx,
10581058
ObjectLiteralExpr *expr);
10591059

1060-
Type getObjectLiteralParameterType(ObjectLiteralExpr *expr,
1061-
ConstructorDecl *ctor);
1062-
10631060
/// Get the module appropriate for looking up standard library types.
10641061
///
10651062
/// This is "Swift", if that module is imported, or the current module if

0 commit comments

Comments
 (0)