Permalink
Browse files

Add support for anonymous class declarations in default exports

This is required because Esprima uses a ClassDeclaration with a null id property when parsing a default export involving an anonymous class.
  • Loading branch information...
zjmiller committed Jan 25, 2016
1 parent 7aa3b04 commit fde0f5357aed9cdd2ab70dba85c37ccb887e9665
View
@@ -1145,7 +1145,10 @@
ClassDeclaration: function (stmt, flags) {
var result, fragment;
result = ['class ' + stmt.id.name];
result = ['class'];
if (stmt.id) {
result = join(result, this.generateExpression(stmt.id, Precedence.Sequence, E_TTT));
}
if (stmt.superClass) {
fragment = join('extends', this.generateExpression(stmt.superClass, Precedence.Assignment, E_TTT));
result = join(result, fragment);
@@ -2,3 +2,7 @@ export default function a() {
}
export default function () {
}
export default class A {
}
export default class {
}
@@ -1 +1 @@
export default function a(){}export default function (){}
export default function a(){}export default function (){}export default class A{}export default class{}
@@ -2,3 +2,5 @@ export default function a () { }
// export default var i = 20;
// export default const K = 20;
export default function () { }
export default class A { }
export default class { }

0 comments on commit fde0f53

Please sign in to comment.