fix: remove check for super in arrow function

This commit is contained in:
Sven SAULEAU
2017-03-07 20:05:26 +01:00
committed by Brian Ng
parent c5bad22767
commit 819056e94a
3 changed files with 27 additions and 2 deletions

View File

@@ -23,15 +23,20 @@ const noMethodVisitor = {
};
const verifyConstructorVisitor = visitors.merge([noMethodVisitor, {
Super(path) {
Super(path, state) {
if (
this.isDerived && !this.hasBareSuper &&
!path.parentPath.isCallExpression({ callee: path.node })
!path.parentPath.isCallExpression({ callee: path.node }) &&
!state.inArrowFunctionExpression
) {
throw path.buildCodeFrameError("'super.*' is not allowed before super()");
}
},
ArrowFunctionExpression(path, state) {
state.inArrowFunctionExpression = true;
},
CallExpression: {
exit(path) {
if (path.get("callee").isSuper()) {