Merge pull request #11837
diff --git a/include/swift/AST/Expr.h b/include/swift/AST/Expr.h
index 46607d1..e78e864 100644
--- a/include/swift/AST/Expr.h
+++ b/include/swift/AST/Expr.h
@@ -1612,9 +1612,22 @@
 /// subscript is available.
 class DynamicLookupExpr : public Expr {
 protected:
-  explicit DynamicLookupExpr(ExprKind kind) : Expr(kind, /*Implicit=*/false) { }
+  Expr *Base;
+  ConcreteDeclRef Member;
+
+  explicit DynamicLookupExpr(ExprKind kind, ConcreteDeclRef member, Expr *base)
+    : Expr(kind, /*Implicit=*/false), Base(base), Member(member) { }
 
 public:
+  /// Retrieve the member to which this access refers.
+  ConcreteDeclRef getMember() const { return Member; }
+
+  /// Retrieve the base of the expression.
+  Expr *getBase() const { return Base; }
+
+  /// Replace the base of the expression.
+  void setBase(Expr *base) { Base = base; }
+
   static bool classof(const Expr *E) {
     return E->getKind() >= ExprKind::First_DynamicLookupExpr &&
            E->getKind() <= ExprKind::Last_DynamicLookupExpr;
@@ -1637,8 +1650,6 @@
 /// print(x.foo!(17)) // x.foo has type ((i : Int) -> String)?
 /// \endcode
 class DynamicMemberRefExpr : public DynamicLookupExpr {
-  Expr *Base;
-  ConcreteDeclRef Member;
   SourceLoc DotLoc;
   DeclNameLoc NameLoc;
 
@@ -1646,19 +1657,10 @@
   DynamicMemberRefExpr(Expr *base, SourceLoc dotLoc,
                        ConcreteDeclRef member,
                        DeclNameLoc nameLoc)
-    : DynamicLookupExpr(ExprKind::DynamicMemberRef),
-      Base(base), Member(member), DotLoc(dotLoc), NameLoc(nameLoc) {
+    : DynamicLookupExpr(ExprKind::DynamicMemberRef, member, base),
+      DotLoc(dotLoc), NameLoc(nameLoc) {
     }
 
-  /// Retrieve the base of the expression.
-  Expr *getBase() const { return Base; }
-
-  /// Replace the base of the expression.
-  void setBase(Expr *base) { Base = base; }
-
-  /// Retrieve the member to which this access refers.
-  ConcreteDeclRef getMember() const { return Member; }
-
   /// Retrieve the location of the member name.
   DeclNameLoc getNameLoc() const { return NameLoc; }
 
@@ -1707,9 +1709,7 @@
       public TrailingCallArguments<DynamicSubscriptExpr> {
   friend TrailingCallArguments;
 
-  Expr *Base;
   Expr *Index;
-  ConcreteDeclRef Member;
 
   DynamicSubscriptExpr(Expr *base, Expr *index, ArrayRef<Identifier> argLabels,
                        ArrayRef<SourceLoc> argLabelLocs,
@@ -1762,9 +1762,6 @@
     return DynamicSubscriptExprBits.HasTrailingClosure;
   }
 
-  /// Retrieve the member to which this access refers.
-  ConcreteDeclRef getMember() const { return Member; }
-
   SourceLoc getLoc() const { return Index->getStartLoc(); }
 
   SourceLoc getStartLoc() const { return Base->getStartLoc(); }
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index ab697a1..819fd19 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -1582,8 +1582,8 @@
                                            bool hasTrailingClosure,
                                            ConcreteDeclRef member,
                                            bool implicit)
-    : DynamicLookupExpr(ExprKind::DynamicSubscript),
-      Base(base), Index(index), Member(member) {
+    : DynamicLookupExpr(ExprKind::DynamicSubscript, member, base),
+      Index(index) {
   DynamicSubscriptExprBits.NumArgLabels = argLabels.size();
   DynamicSubscriptExprBits.HasArgLabelLocs = !argLabelLocs.empty();
   DynamicSubscriptExprBits.HasTrailingClosure = hasTrailingClosure;