Skip to content

Commit

Permalink
chore: Remove abstract function bodies in closure rewriting (#2610)
Browse files Browse the repository at this point in the history
  • Loading branch information
kfranqueiro authored Apr 23, 2018
1 parent 68f4ad0 commit 80cb942
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions scripts/rewrite-decl-statements-for-closure-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,14 @@ function transform(srcFile, rootDir) {
}
path.replaceWith(variableDeclaration);
},

ClassMethod(path) {
// Remove any statements from abstract function bodies.
// Closure doesn't like seeing this, but we like to include a throw statement for non-closure clients.
if (path.node.comments && path.node.comments.some((comment) => comment.value.includes('@abstract'))) {
path.node.body.body = [];
}
},
});

let {code: outputCode} = recast.print(ast, {
Expand Down

0 comments on commit 80cb942

Please sign in to comment.