[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}
This commit is contained in:
parent
a31cef44dc
commit
7f1504f51e
@ -378,10 +378,19 @@ void AstExpressionVisitor::VisitEmptyParentheses(EmptyParentheses* expr) {}
|
||||
|
||||
|
||||
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
|
||||
|
@ -54,6 +54,7 @@
|
||||
((x, [y = x]) => assertEquals(42, y))(42, []);
|
||||
})();
|
||||
|
||||
|
||||
(function testMultiScopeCapture() {
|
||||
"use strict";
|
||||
var x = 1;
|
||||
@ -67,3 +68,31 @@
|
||||
})(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();
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user