Commit 7f1504f5 authored by adamk's avatar adamk Committed by Commit bot

[es6] Handle super properly when rewriting arrow parameter initializers

R=rossberg@chromium.org
BUG=v8:4395
LOG=y

Review URL: https://codereview.chromium.org/1414733005

Cr-Commit-Position: refs/heads/master@{#31440}
parent a31cef44
...@@ -378,10 +378,19 @@ void AstExpressionVisitor::VisitEmptyParentheses(EmptyParentheses* expr) {} ...@@ -378,10 +378,19 @@ void AstExpressionVisitor::VisitEmptyParentheses(EmptyParentheses* expr) {}
void AstExpressionVisitor::VisitSuperPropertyReference( void AstExpressionVisitor::VisitSuperPropertyReference(
SuperPropertyReference* expr) {} SuperPropertyReference* expr) {
VisitExpression(expr);
RECURSE_EXPRESSION(VisitVariableProxy(expr->this_var()));
RECURSE_EXPRESSION(Visit(expr->home_object()));
}
void AstExpressionVisitor::VisitSuperCallReference(SuperCallReference* expr) {} void AstExpressionVisitor::VisitSuperCallReference(SuperCallReference* expr) {
VisitExpression(expr);
RECURSE_EXPRESSION(VisitVariableProxy(expr->this_var()));
RECURSE_EXPRESSION(VisitVariableProxy(expr->new_target_var()));
RECURSE_EXPRESSION(VisitVariableProxy(expr->this_function_var()));
}
} // namespace internal } // namespace internal
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
((x, [y = x]) => assertEquals(42, y))(42, []); ((x, [y = x]) => assertEquals(42, y))(42, []);
})(); })();
(function testMultiScopeCapture() { (function testMultiScopeCapture() {
"use strict"; "use strict";
var x = 1; var x = 1;
...@@ -67,3 +68,31 @@ ...@@ -67,3 +68,31 @@
})(3, 4); })(3, 4);
} }
})(); })();
(function testSuper() {
"use strict";
class A {
x() { return 42; }
}
class B extends A {
y() {
((q = super.x()) => assertEquals(42, q))();
}
}
new B().y();
class C {
constructor() { return { prop: 42 } }
}
class D extends C{
constructor() {
((q = super()) => assertEquals(42, q.prop))();
}
}
new D();
})();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment