Fixes #612 - Compile error when class method has empty return

This commit is contained in:
Patrick Steele-Idem 2017-03-07 13:26:56 -07:00
parent 80628146ad
commit a4032b7e95
3 changed files with 16 additions and 4 deletions

View File

@ -8,7 +8,6 @@ function parseExpression(src, builder, isExpression) {
ok(builder, '"builder" is required');
function convert(node) {
if (Array.isArray(node)) {
let nodes = node;
for (let i=0; i<nodes.length; i++) {
@ -203,9 +202,13 @@ function parseExpression(src, builder, isExpression) {
return builder.property(key, value);
}
case 'ReturnStatement': {
let argument = convert(node.argument);
if (!argument) {
return null;
var argument = node.argument;
if (argument != null) {
argument = convert(node.argument);
if (!argument) {
return null;
}
}
return builder.returnStatement(argument);

View File

@ -0,0 +1,8 @@
class {
test(e) {
return;
}
}
<div class="test">
</div>