mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Rename FuncDecl::getBody() to FuncDecl::getFuncExpr()
ConstructorDecl::getBody() and DestructorDecl::getBody() return 'BraceStmt *'. After changing the AST representation for functions, FuncDecl::getBody() will return 'BraceStmt *' and FuncDecl::getFuncExpr() will be gone. Swift SVN r8050
This commit is contained in:
@@ -1894,7 +1894,7 @@ class FuncDecl : public ValueDecl {
|
||||
SourceLoc FuncLoc; // Location of the 'func' token.
|
||||
SourceLoc NameLoc;
|
||||
GenericParamList *GenericParams;
|
||||
FuncExpr *Body;
|
||||
FuncExpr *TheFuncExprBody;
|
||||
llvm::PointerIntPair<Decl *, 1, bool> GetOrSetDecl;
|
||||
FuncDecl *OverriddenDecl;
|
||||
OperatorDecl *Operator;
|
||||
@@ -1902,10 +1902,11 @@ class FuncDecl : public ValueDecl {
|
||||
public:
|
||||
FuncDecl(SourceLoc StaticLoc, SourceLoc FuncLoc, Identifier Name,
|
||||
SourceLoc NameLoc, GenericParamList *GenericParams, Type Ty,
|
||||
FuncExpr *Body, DeclContext *DC)
|
||||
FuncExpr *TheFuncExprBody, DeclContext *DC)
|
||||
: ValueDecl(DeclKind::Func, DC, Name), StaticLoc(StaticLoc),
|
||||
FuncLoc(FuncLoc), NameLoc(NameLoc), GenericParams(GenericParams),
|
||||
Body(Body), OverriddenDecl(nullptr), Operator(nullptr) {
|
||||
TheFuncExprBody(TheFuncExprBody), OverriddenDecl(nullptr),
|
||||
Operator(nullptr) {
|
||||
FuncDeclBits.Static = StaticLoc.isValid() || getName().isOperator();
|
||||
setType(Ty);
|
||||
}
|
||||
@@ -1917,9 +1918,9 @@ public:
|
||||
FuncDeclBits.Static = Static;
|
||||
}
|
||||
|
||||
FuncExpr *getBody() { return Body; }
|
||||
const FuncExpr *getBody() const { return Body; }
|
||||
void setBody(FuncExpr *NewBody) { Body = NewBody; }
|
||||
FuncExpr *getFuncExpr() { return TheFuncExprBody; }
|
||||
const FuncExpr *getFuncExpr() const { return TheFuncExprBody; }
|
||||
void setFuncExpr(FuncExpr *NewBody) { TheFuncExprBody = NewBody; }
|
||||
|
||||
/// getCaptures - Return the list of declarations captured by the function.
|
||||
/// This includes global variables, so it is all variables referenced.
|
||||
|
||||
@@ -405,7 +405,7 @@ namespace {
|
||||
}
|
||||
OS << '\n';
|
||||
|
||||
printRec(FD->getBody());
|
||||
printRec(FD->getFuncExpr());
|
||||
OS << ')';
|
||||
}
|
||||
|
||||
|
||||
@@ -629,7 +629,7 @@ void PrintAST::visitFuncDecl(FuncDecl *decl) {
|
||||
} else {
|
||||
OS << "set";
|
||||
|
||||
auto bodyParams = decl->getBody()->getBodyParamPatterns();
|
||||
auto bodyParams = decl->getFuncExpr()->getBodyParamPatterns();
|
||||
auto valueParam = bodyParams.back()->getSemanticsProvidingPattern();
|
||||
if (auto named = dyn_cast<NamedPattern>(valueParam)) {
|
||||
OS << "(" << named->getBoundName().str() << ")";
|
||||
@@ -637,11 +637,11 @@ void PrintAST::visitFuncDecl(FuncDecl *decl) {
|
||||
OS << ": ";
|
||||
}
|
||||
|
||||
if (!Options.FunctionDefinitions || !decl->getBody()->getBody()) {
|
||||
if (!Options.FunctionDefinitions || !decl->getFuncExpr()->getBody()) {
|
||||
return;
|
||||
}
|
||||
|
||||
printBraceStmtElements(decl->getBody()->getBody());
|
||||
printBraceStmtElements(decl->getFuncExpr()->getBody());
|
||||
} else {
|
||||
if (decl->isStatic() && !decl->isOperator())
|
||||
OS << "static ";
|
||||
@@ -657,10 +657,10 @@ void PrintAST::visitFuncDecl(FuncDecl *decl) {
|
||||
}
|
||||
|
||||
if (!printSelectorStyleArgs(decl,
|
||||
decl->getBody()->getArgParamPatterns(),
|
||||
decl->getBody()->getBodyParamPatterns())) {
|
||||
decl->getFuncExpr()->getArgParamPatterns(),
|
||||
decl->getFuncExpr()->getBodyParamPatterns())) {
|
||||
bool first = true;
|
||||
for (auto pattern : decl->getBody()->getArgParamPatterns()) {
|
||||
for (auto pattern : decl->getFuncExpr()->getArgParamPatterns()) {
|
||||
if (first) {
|
||||
first = false;
|
||||
|
||||
@@ -674,18 +674,18 @@ void PrintAST::visitFuncDecl(FuncDecl *decl) {
|
||||
}
|
||||
|
||||
auto &context = decl->getASTContext();
|
||||
Type resultTy = decl->getBody()->getResultType(context);
|
||||
Type resultTy = decl->getFuncExpr()->getResultType(context);
|
||||
if (resultTy && !resultTy->isEqual(TupleType::getEmpty(context))) {
|
||||
OS << " -> ";
|
||||
resultTy->print(OS);
|
||||
}
|
||||
|
||||
if (!Options.FunctionDefinitions || !decl->getBody()->getBody()) {
|
||||
if (!Options.FunctionDefinitions || !decl->getFuncExpr()->getBody()) {
|
||||
return;
|
||||
}
|
||||
|
||||
OS << " ";
|
||||
visit(decl->getBody()->getBody());
|
||||
visit(decl->getFuncExpr()->getBody());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -509,12 +509,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
} else if (FuncDecl *FD = dyn_cast<FuncDecl>(D)) {
|
||||
FuncExpr *Body = FD->getBody();
|
||||
FuncExpr *Body = FD->getFuncExpr();
|
||||
#ifndef NDEBUG
|
||||
PrettyStackTraceDecl debugStack("walking into body of", FD);
|
||||
#endif
|
||||
if (FuncExpr *E2 = cast_or_null<FuncExpr>(doIt(Body)))
|
||||
FD->setBody(E2);
|
||||
FD->setFuncExpr(E2);
|
||||
else
|
||||
return true;
|
||||
} else if (ExtensionDecl *ED = dyn_cast<ExtensionDecl>(D)) {
|
||||
|
||||
@@ -184,7 +184,7 @@ bool ValueDecl::isDefinition() const {
|
||||
llvm_unreachable("non-value decls shouldn't get here");
|
||||
|
||||
case DeclKind::Func:
|
||||
return cast<FuncDecl>(this)->getBody() != 0;
|
||||
return cast<FuncDecl>(this)->getFuncExpr() != 0;
|
||||
|
||||
case DeclKind::Var:
|
||||
case DeclKind::Union:
|
||||
@@ -266,7 +266,7 @@ std::pair<DefaultArgumentKind, Type>
|
||||
ValueDecl::getDefaultArg(unsigned index) const {
|
||||
ArrayRef<const Pattern *> patterns;
|
||||
if (auto func = dyn_cast<FuncDecl>(this)) {
|
||||
patterns = func->getBody()->getArgParamPatterns();
|
||||
patterns = func->getFuncExpr()->getArgParamPatterns();
|
||||
|
||||
// Skip the 'self' parameter; it is not counted.
|
||||
if (func->getDeclContext()->isTypeContext())
|
||||
@@ -640,31 +640,31 @@ bool VarDecl::isAnonClosureParam() const {
|
||||
}
|
||||
|
||||
VarDecl *FuncDecl::getImplicitSelfDecl() const {
|
||||
return Body->getImplicitSelfDecl();
|
||||
return TheFuncExprBody->getImplicitSelfDecl();
|
||||
}
|
||||
|
||||
/// getNaturalArgumentCount - Returns the "natural" number of
|
||||
/// argument clauses taken by this function.
|
||||
unsigned FuncDecl::getNaturalArgumentCount() const {
|
||||
return getBody()->getNaturalArgumentCount();
|
||||
return TheFuncExprBody->getNaturalArgumentCount();
|
||||
}
|
||||
|
||||
ArrayRef<ValueDecl*> FuncDecl::getCaptures() const {
|
||||
if (Body)
|
||||
return Body->getCaptures();
|
||||
if (TheFuncExprBody)
|
||||
return TheFuncExprBody->getCaptures();
|
||||
else
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<ValueDecl*> FuncDecl::getLocalCaptures() const {
|
||||
if (Body)
|
||||
return Body->getLocalCaptures();
|
||||
if (TheFuncExprBody)
|
||||
return TheFuncExprBody->getLocalCaptures();
|
||||
return std::vector<ValueDecl*>();
|
||||
}
|
||||
|
||||
bool FuncDecl::hasLocalCaptures() const {
|
||||
if (Body)
|
||||
return Body->hasLocalCaptures();
|
||||
if (TheFuncExprBody)
|
||||
return TheFuncExprBody->hasLocalCaptures();
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -755,8 +755,8 @@ bool FuncDecl::isUnaryOperator() const {
|
||||
|
||||
unsigned opArgIndex = isa<ProtocolDecl>(getDeclContext()) ? 1 : 0;
|
||||
|
||||
auto *argTuple
|
||||
= dyn_cast<TuplePattern>(getBody()->getArgParamPatterns()[opArgIndex]);
|
||||
auto *argTuple = dyn_cast<TuplePattern>(
|
||||
TheFuncExprBody -> getArgParamPatterns()[opArgIndex]);
|
||||
if (!argTuple)
|
||||
return true;
|
||||
|
||||
@@ -769,8 +769,8 @@ bool FuncDecl::isBinaryOperator() const {
|
||||
|
||||
unsigned opArgIndex = isa<ProtocolDecl>(getDeclContext()) ? 1 : 0;
|
||||
|
||||
auto *argTuple
|
||||
= dyn_cast<TuplePattern>(getBody()->getArgParamPatterns()[opArgIndex]);
|
||||
auto *argTuple = dyn_cast<TuplePattern>(
|
||||
TheFuncExprBody -> getArgParamPatterns()[opArgIndex]);
|
||||
if (!argTuple)
|
||||
return false;
|
||||
|
||||
@@ -812,7 +812,7 @@ StringRef FuncDecl::getObjCSelector(SmallVectorImpl<char> &buffer) const {
|
||||
out << getName().str();
|
||||
|
||||
// We should always have exactly two levels of argument pattern.
|
||||
auto argPatterns = getBody()->getArgParamPatterns();
|
||||
auto argPatterns = TheFuncExprBody->getArgParamPatterns();
|
||||
assert(argPatterns.size() == 2);
|
||||
const Pattern *pattern = argPatterns[1];
|
||||
auto tuple = dyn_cast<TuplePattern>(pattern);
|
||||
@@ -848,7 +848,7 @@ StringRef FuncDecl::getObjCSelector(SmallVectorImpl<char> &buffer) const {
|
||||
}
|
||||
|
||||
SourceRange FuncDecl::getSourceRange() const {
|
||||
return Body->getSourceRange();
|
||||
return TheFuncExprBody->getSourceRange();
|
||||
}
|
||||
|
||||
SourceRange UnionElementDecl::getSourceRange() const {
|
||||
|
||||
@@ -1489,7 +1489,7 @@ namespace {
|
||||
auto &context = Impl.SwiftContext;
|
||||
auto loc = setter->getLoc();
|
||||
auto tuple = cast<TuplePattern>(
|
||||
setter->getBody()->getBodyParamPatterns()[1]);
|
||||
setter->getFuncExpr()->getBodyParamPatterns()[1]);
|
||||
|
||||
// Objective-C subscript setters are imported with a function type
|
||||
// such as:
|
||||
@@ -1694,7 +1694,7 @@ namespace {
|
||||
// Find the getter indices and make sure they match.
|
||||
{
|
||||
auto tuple = dyn_cast<TuplePattern>(
|
||||
getter->getBody()->getArgParamPatterns()[1]);
|
||||
getter->getFuncExpr()->getArgParamPatterns()[1]);
|
||||
if (tuple && tuple->getFields().size() != 1)
|
||||
return nullptr;
|
||||
|
||||
@@ -1706,7 +1706,7 @@ namespace {
|
||||
Pattern *setterIndices = nullptr;
|
||||
if (setter) {
|
||||
auto tuple = dyn_cast<TuplePattern>(
|
||||
setter->getBody()->getBodyParamPatterns()[1]);
|
||||
setter->getFuncExpr()->getBodyParamPatterns()[1]);
|
||||
if (!tuple)
|
||||
return nullptr;
|
||||
|
||||
@@ -1730,7 +1730,7 @@ namespace {
|
||||
|
||||
// Build the subscript declaration.
|
||||
auto argPatterns
|
||||
= getterThunk->getBody()->getArgParamPatterns()[1]->clone(context);
|
||||
= getterThunk->getFuncExpr()->getArgParamPatterns()[1]->clone(context);
|
||||
auto name = context.getIdentifier("__subscript");
|
||||
auto subscript
|
||||
= new (context) SubscriptDecl(name, decl->getLoc(), argPatterns,
|
||||
|
||||
@@ -648,7 +648,7 @@ public:
|
||||
Builder.addLeadingDot();
|
||||
Builder.addTextChunk(Name);
|
||||
Builder.addLeftParen();
|
||||
auto *FE = FD->getBody();
|
||||
auto *FE = FD->getFuncExpr();
|
||||
auto Patterns = FE->getArgParamPatterns();
|
||||
unsigned FirstIndex = 0;
|
||||
if (!IsImlicitlyCurriedInstanceMethod && FE->getImplicitSelfDecl())
|
||||
@@ -1071,7 +1071,7 @@ void CodeCompletionCallbacksImpl::doneParsing() {
|
||||
return;
|
||||
|
||||
if (auto *FD = dyn_cast_or_null<FuncDecl>(DelayedParsedDecl))
|
||||
CurDeclContext = FD->getBody();
|
||||
CurDeclContext = FD->getFuncExpr();
|
||||
|
||||
if (ParsedExpr && !typecheckParsedExpr())
|
||||
return;
|
||||
|
||||
@@ -130,7 +130,7 @@ static unsigned getNumCurries(AnyFunctionType *type) {
|
||||
/// in the function body.
|
||||
unsigned irgen::getDeclNaturalUncurryLevel(ValueDecl *val) {
|
||||
if (FuncDecl *func = dyn_cast<FuncDecl>(val)) {
|
||||
return func->getBody()->getNaturalArgumentCount() - 1;
|
||||
return func->getFuncExpr()->getNaturalArgumentCount() - 1;
|
||||
}
|
||||
if (isa<ConstructorDecl>(val) || isa<UnionElementDecl>(val)) {
|
||||
return 1;
|
||||
@@ -2052,8 +2052,8 @@ void IRGenModule::emitLocalDecls(BraceStmt *body) {
|
||||
}
|
||||
|
||||
void IRGenModule::emitLocalDecls(FuncDecl *fd) {
|
||||
if (fd->getBody() && fd->getBody()->getBody())
|
||||
emitLocalDecls(fd->getBody()->getBody());
|
||||
if (fd->getFuncExpr() && fd->getFuncExpr()->getBody())
|
||||
emitLocalDecls(fd->getFuncExpr()->getBody());
|
||||
}
|
||||
|
||||
void IRGenModule::emitLocalDecls(ConstructorDecl *cd) {
|
||||
|
||||
@@ -1680,7 +1680,7 @@ Parser::parseDeclFunc(SourceLoc StaticLoc, unsigned Flags) {
|
||||
}
|
||||
|
||||
bool Parser::parseDeclFuncBodyDelayed(FuncDecl *FD) {
|
||||
auto FE = FD->getBody();
|
||||
auto FE = FD->getFuncExpr();
|
||||
assert(!FE->getBody() && "function should not have a parsed body");
|
||||
assert(FE->getBodyKind() == FuncExpr::BodyKind::Unparsed &&
|
||||
"function body should be delayed");
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
virtual bool walkToDeclPre(Decl *D) {
|
||||
if (auto FD = dyn_cast<FuncDecl>(D)) {
|
||||
if (auto FE = FD->getBody()) {
|
||||
if (auto FE = FD->getFuncExpr()) {
|
||||
if (FE->getBodyKind() != FuncExpr::BodyKind::Unparsed)
|
||||
return false;
|
||||
parseFunctionBody(FD);
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
|
||||
private:
|
||||
void parseFunctionBody(FuncDecl *FD) {
|
||||
auto FE = FD->getBody();
|
||||
auto FE = FD->getFuncExpr();
|
||||
assert(FE);
|
||||
assert(FE->getBodyKind() == FuncExpr::BodyKind::Unparsed);
|
||||
|
||||
|
||||
@@ -39,8 +39,8 @@ static unsigned getFuncNaturalUncurryLevel(CapturingExpr *func) {
|
||||
}
|
||||
|
||||
static unsigned getFuncNaturalUncurryLevel(FuncDecl *fd) {
|
||||
if (fd->getBody())
|
||||
return getFuncNaturalUncurryLevel(fd->getBody());
|
||||
if (fd->getFuncExpr())
|
||||
return getFuncNaturalUncurryLevel(fd->getFuncExpr());
|
||||
// Assume func decls without bodies (e.g., builtins) have uncurry level zero.
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -258,7 +258,7 @@ bool SILGenModule::hasFunction(SILDeclRef constant) {
|
||||
}
|
||||
|
||||
void SILGenModule::visitFuncDecl(FuncDecl *fd) {
|
||||
emitFunction(fd, fd->getBody());
|
||||
emitFunction(fd, fd->getFuncExpr());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@@ -451,8 +451,9 @@ void SILGenModule::emitObjCMethodThunk(FuncDecl *method) {
|
||||
// Don't emit the thunk if it already exists.
|
||||
if (hasFunction(thunk))
|
||||
return;
|
||||
// TODO: why we have getBody here?
|
||||
SILFunction *f = preEmitFunction(thunk, method->getBody(), method->getBody());
|
||||
// TODO: why we have getFuncExpr here?
|
||||
SILFunction *f = preEmitFunction(thunk, method->getFuncExpr(),
|
||||
method->getFuncExpr());
|
||||
SILGenFunction(*this, *f).emitObjCMethodThunk(thunk);
|
||||
postEmitFunction(thunk, f);
|
||||
}
|
||||
|
||||
@@ -117,14 +117,14 @@ ArrayRef<Substitution> SILGenFunction::getForwardingSubstitutions() {
|
||||
|
||||
void SILGenFunction::visitFuncDecl(FuncDecl *fd) {
|
||||
// Generate the local function body.
|
||||
SGM.emitFunction(fd, fd->getBody());
|
||||
SGM.emitFunction(fd, fd->getFuncExpr());
|
||||
|
||||
// If there are captures, build the local closure value for the function and
|
||||
// store it as a local constant.
|
||||
if (fd->hasLocalCaptures()) {
|
||||
SILValue closure = emitClosureForCapturingExpr(fd, SILDeclRef(fd),
|
||||
getForwardingSubstitutions(),
|
||||
fd->getBody())
|
||||
fd->getFuncExpr())
|
||||
.forward(*this);
|
||||
Cleanups.pushCleanup<CleanupClosureConstant>(closure);
|
||||
LocalConstants[SILDeclRef(fd)] = closure;
|
||||
@@ -784,7 +784,7 @@ public:
|
||||
SILGenType(SGM, ntd).emitType();
|
||||
}
|
||||
void visitFuncDecl(FuncDecl *fd) {
|
||||
SGM.emitFunction(fd, fd->getBody());
|
||||
SGM.emitFunction(fd, fd->getFuncExpr());
|
||||
// FIXME: Default implementations in protocols.
|
||||
if (SGM.requiresObjCMethodEntryPoint(fd) &&
|
||||
!isa<ProtocolDecl>(fd->getDeclContext()))
|
||||
@@ -827,7 +827,7 @@ void SILGenModule::emitExternalDefinition(Decl *d) {
|
||||
switch (d->getKind()) {
|
||||
case DeclKind::Func: {
|
||||
auto *fd = cast<FuncDecl>(d);
|
||||
emitFunction(fd, fd->getBody());
|
||||
emitFunction(fd, fd->getFuncExpr());
|
||||
break;
|
||||
}
|
||||
case DeclKind::Constructor: {
|
||||
@@ -906,7 +906,7 @@ public:
|
||||
SILGenType(SGM, ntd).emitType();
|
||||
}
|
||||
void visitFuncDecl(FuncDecl *fd) {
|
||||
SGM.emitFunction(fd, fd->getBody());
|
||||
SGM.emitFunction(fd, fd->getFuncExpr());
|
||||
if (SGM.requiresObjCMethodEntryPoint(fd))
|
||||
SGM.emitObjCMethodThunk(fd);
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ static Expr *simplifyLocatorToAnchor(ConstraintSystem &cs,
|
||||
///
|
||||
static Pattern *getParameterPattern(ValueDecl *decl) {
|
||||
if (auto func = dyn_cast<FuncDecl>(decl))
|
||||
return func->getBody()->getArgParamPatterns()[0];
|
||||
return func->getFuncExpr()->getArgParamPatterns()[0];
|
||||
if (auto constructor = dyn_cast<ConstructorDecl>(decl))
|
||||
return constructor->getArguments();
|
||||
if (auto subscript = dyn_cast<SubscriptDecl>(decl))
|
||||
|
||||
@@ -1168,7 +1168,7 @@ public:
|
||||
}
|
||||
|
||||
void semaFuncExpr(FuncDecl *FD, bool consumeAttributes) {
|
||||
FuncExpr *FE = FD->getBody();
|
||||
FuncExpr *FE = FD->getFuncExpr();
|
||||
|
||||
if (FE->getType())
|
||||
return;
|
||||
@@ -1316,7 +1316,7 @@ public:
|
||||
|
||||
void visitFuncDecl(FuncDecl *FD) {
|
||||
if (!IsFirstPass) {
|
||||
if (auto body = FD->getBody())
|
||||
if (auto body = FD->getFuncExpr())
|
||||
if (body->getBody())
|
||||
TC.definedFunctions.push_back(body);
|
||||
}
|
||||
@@ -1328,7 +1328,7 @@ public:
|
||||
if (FD->isOperator())
|
||||
bindFuncDeclToOperator(FD);
|
||||
|
||||
FuncExpr *body = FD->getBody();
|
||||
FuncExpr *body = FD->getFuncExpr();
|
||||
|
||||
// Before anything else, set up the 'self' argument correctly.
|
||||
GenericParamList *outerGenericParams = nullptr;
|
||||
|
||||
@@ -615,7 +615,7 @@ void swift::performTypeChecking(TranslationUnit *TU, unsigned StartElem) {
|
||||
continue;
|
||||
}
|
||||
if (auto func = dyn_cast<FuncDecl>(decl)) {
|
||||
FuncExpr *FE = func->getBody();
|
||||
FuncExpr *FE = func->getFuncExpr();
|
||||
PrettyStackTraceExpr StackEntry(TC.Context, "type-checking", FE);
|
||||
TC.typeCheckFunctionBody(FE);
|
||||
continue;
|
||||
|
||||
@@ -592,7 +592,7 @@ DeclContext *ModuleFile::getDeclContext(DeclID DID) {
|
||||
if (auto DD = dyn_cast<DestructorDecl>(D))
|
||||
return DD;
|
||||
if (auto FD = dyn_cast<FuncDecl>(D))
|
||||
return FD->getBody();
|
||||
return FD->getFuncExpr();
|
||||
|
||||
llvm_unreachable("unknown DeclContext kind");
|
||||
}
|
||||
@@ -956,7 +956,7 @@ Decl *ModuleFile::getDecl(DeclID DID, Optional<DeclContext *> ForcedContext,
|
||||
TypeLoc::withoutLoc(signature->getResult()),
|
||||
DC);
|
||||
body->setType(signature);
|
||||
fn->setBody(body);
|
||||
fn->setFuncExpr(body);
|
||||
|
||||
if (genericParams)
|
||||
for (auto &genericParam : *fn->getGenericParams())
|
||||
|
||||
@@ -1156,9 +1156,9 @@ void Serializer::writeDecl(const Decl *D) {
|
||||
|
||||
// Write both argument and body parameters. This is important for proper
|
||||
// error messages with selector-style declarations.
|
||||
for (auto pattern : fn->getBody()->getArgParamPatterns())
|
||||
for (auto pattern : fn->getFuncExpr()->getArgParamPatterns())
|
||||
writePattern(pattern);
|
||||
for (auto pattern : fn->getBody()->getBodyParamPatterns())
|
||||
for (auto pattern : fn->getFuncExpr()->getBodyParamPatterns())
|
||||
writePattern(pattern);
|
||||
|
||||
if (fn->getAttrs().isConversion())
|
||||
|
||||
Reference in New Issue
Block a user