Bug 1203733 - Fix emitting super.prop1.prop2. (r=jorendorff)
authorEric Faust <efaustbmo@gmail.com>
Fri, 18 Sep 2015 09:23:21 -0700
changeset 295894 39fe4a6488237d8a8a91ba07aa8c24381eabff61
parent 295893 4f0cd3e94c0a34500c60951e3e80bcd312167fe5
child 295895 977d5b7ecba32a0617d40c231e2f16963bf4a4ef
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1203733
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1203733 - Fix emitting super.prop1.prop2. (r=jorendorff)
js/src/frontend/BytecodeEmitter.cpp
js/src/tests/ecma_6/Class/superPropBasicChain.js
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -2546,27 +2546,26 @@ BytecodeEmitter::emitNameOp(ParseNode* p
 
     return true;
 }
 
 bool
 BytecodeEmitter::emitPropLHS(ParseNode* pn)
 {
     MOZ_ASSERT(pn->isKind(PNK_DOT));
+    MOZ_ASSERT(!pn->as<PropertyAccess>().isSuper());
+
     ParseNode* pn2 = pn->maybeExpr();
 
-    // Don't want super sneaking in here.
-    MOZ_ASSERT(!pn2->isKind(PNK_POSHOLDER));
-
     /*
      * If the object operand is also a dotted property reference, reverse the
      * list linked via pn_expr temporarily so we can iterate over it from the
      * bottom up (reversing again as we go), to avoid excessive recursion.
      */
-    if (pn2->isKind(PNK_DOT)) {
+    if (pn2->isKind(PNK_DOT) && !pn2->as<PropertyAccess>().isSuper()) {
         ParseNode* pndot = pn2;
         ParseNode* pnup = nullptr;
         ParseNode* pndown;
         ptrdiff_t top = offset();
         for (;;) {
             /* Reverse pndot->pn_expr to point up, not down. */
             pndot->pn_offset = top;
             MOZ_ASSERT(!pndot->isUsed());
new file mode 100644
--- /dev/null
+++ b/js/src/tests/ecma_6/Class/superPropBasicChain.js
@@ -0,0 +1,18 @@
+var test = `
+
+var o = {
+    access() {
+        super.foo.bar;
+    }
+};
+
+// Delazify
+assertThrowsInstanceOf(o.access, TypeError);
+
+`;
+
+if (classesEnabled())
+    eval(test);
+
+if (typeof reportCompare === 'function')
+    reportCompare(0,0,"OK");