Skip to content

Commit ae37545

Browse files
authored
Merge pull request swiftlang#37062 from hamishknight/sup
[AST] Remove 'is super' bit on ApplyExpr
2 parents a21f323 + d309cae commit ae37545

File tree

6 files changed

+6
-27
lines changed

6 files changed

+6
-27
lines changed

include/swift/AST/Expr.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4444,16 +4444,16 @@ class ApplyExpr : public Expr {
44444444
/// The function being called.
44454445
Expr *Fn;
44464446

4447-
/// The argument being passed to it, and whether it's a 'super' argument.
4448-
llvm::PointerIntPair<Expr *, 1, bool> ArgAndIsSuper;
4447+
/// The argument being passed to it.
4448+
Expr *Arg;
44494449

44504450
/// Returns true if \c e could be used as the call's argument. For most \c ApplyExpr
44514451
/// subclasses, this means it is a \c ParenExpr or \c TupleExpr.
44524452
bool validateArg(Expr *e) const;
44534453

44544454
protected:
44554455
ApplyExpr(ExprKind Kind, Expr *Fn, Expr *Arg, bool Implicit, Type Ty = Type())
4456-
: Expr(Kind, Implicit, Ty), Fn(Fn), ArgAndIsSuper(Arg, false) {
4456+
: Expr(Kind, Implicit, Ty), Fn(Fn), Arg(Arg) {
44574457
assert(classof((Expr*)this) && "ApplyExpr::classof out of date");
44584458
assert(validateArg(Arg) && "Arg is not a permitted expr kind");
44594459
Bits.ApplyExpr.ThrowsIsSet = false;
@@ -4466,15 +4466,10 @@ class ApplyExpr : public Expr {
44664466
void setFn(Expr *e) { Fn = e; }
44674467
Expr *getSemanticFn() const { return Fn->getSemanticsProvidingExpr(); }
44684468

4469-
Expr *getArg() const { return ArgAndIsSuper.getPointer(); }
4469+
Expr *getArg() const { return Arg; }
44704470
void setArg(Expr *e) {
44714471
assert(validateArg(e) && "Arg is not a permitted expr kind");
4472-
ArgAndIsSuper = {e, ArgAndIsSuper.getInt()};
4473-
}
4474-
4475-
bool isSuper() const { return ArgAndIsSuper.getInt(); }
4476-
void setIsSuper(bool super) {
4477-
ArgAndIsSuper = {ArgAndIsSuper.getPointer(), super};
4472+
Arg = e;
44784473
}
44794474

44804475
/// Has the type-checker set the 'throws' bit yet?

lib/AST/ASTDumper.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2621,8 +2621,6 @@ class PrintExpr : public ExprVisitor<PrintExpr> {
26212621

26222622
void printApplyExpr(ApplyExpr *E, const char *NodeName) {
26232623
printCommon(E, NodeName);
2624-
if (E->isSuper())
2625-
PrintWithColorRAII(OS, ExprModifierColor) << " super";
26262624
if (E->isThrowsSet()) {
26272625
PrintWithColorRAII(OS, ExprModifierColor)
26282626
<< (E->throws() ? " throws" : " nothrow");

lib/AST/ASTVerifier.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1821,12 +1821,6 @@ class Verifier : public ASTWalker {
18211821
}
18221822
}
18231823

1824-
if (E->isSuper() != E->getArg()->isSuperExpr()) {
1825-
Out << "Function application's isSuper() bit mismatch.\n";
1826-
E->dump(Out);
1827-
Out << "\n";
1828-
abort();
1829-
}
18301824
verifyCheckedBase(E);
18311825
}
18321826

lib/SILGen/SILGenApply.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,7 +850,7 @@ class SILGenApply : public Lowering::ExprVisitor<SILGenApply> {
850850
if (isMethodSelfApply(e->getFn())) {
851851
selfApply = cast<ApplyExpr>(e->getFn());
852852

853-
if (selfApply->isSuper()) {
853+
if (selfApply->getArg()->isSuperExpr()) {
854854
applySuper(selfApply);
855855
return;
856856
}

lib/Sema/CSApply.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,9 +1179,6 @@ namespace {
11791179
selfCall->setType(refTy->getResult());
11801180
cs.cacheType(selfCall);
11811181

1182-
if (selfParamRef->isSuperExpr())
1183-
selfCall->setIsSuper(true);
1184-
11851182
auto &appliedWrappers = solution.appliedPropertyWrappers[locator.getAnchor()];
11861183
if (!appliedWrappers.empty()) {
11871184
auto fnDecl = AnyFunctionRef(dyn_cast<AbstractFunctionDecl>(member));
@@ -7749,9 +7746,6 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
77497746

77507747
apply->setFn(fn);
77517748

7752-
// Check whether the argument is 'super'.
7753-
bool isSuper = apply->getArg()->isSuperExpr();
7754-
77557749
// For function application, convert the argument to the input type of
77567750
// the function.
77577751
SmallVector<Identifier, 2> argLabelsScratch;
@@ -7768,7 +7762,6 @@ Expr *ExprRewriter::finishApply(ApplyExpr *apply, Type openedType,
77687762

77697763
apply->setArg(arg);
77707764
cs.setType(apply, fnType->getResult());
7771-
apply->setIsSuper(isSuper);
77727765

77737766
solution.setExprTypes(apply);
77747767
Expr *result = TypeChecker::substituteInputSugarTypeForResult(apply);

lib/Sema/CodeSynthesis.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,6 @@ synthesizeDesignatedInitOverride(AbstractFunctionDecl *fn, void *context) {
626626
type = funcTy->getResult();
627627
auto *superclassCtorRefExpr =
628628
new (ctx) DotSyntaxCallExpr(ctorRefExpr, SourceLoc(), superRef, type);
629-
superclassCtorRefExpr->setIsSuper(true);
630629
superclassCtorRefExpr->setThrows(false);
631630

632631
auto *bodyParams = ctor->getParameters();

0 commit comments

Comments
 (0)