Browse Source

handle export default{}

gh-1187
Rich Harris 8 years ago
parent
commit
e7fa75cfe4
  1. 2
      src/ast/nodes/ExportDefaultDeclaration.js
  2. 8
      test/function/export-default-no-space/_config.js
  3. 1
      test/function/export-default-no-space/main.js

2
src/ast/nodes/ExportDefaultDeclaration.js

@ -53,7 +53,7 @@ export default class ExportDefaultDeclaration extends Node {
let declaration_start;
if ( this.declaration ) {
const statementStr = code.original.slice( this.start, this.end );
declaration_start = this.start + statementStr.match(/^\s*export\s+default\s+/)[0].length;
declaration_start = this.start + statementStr.match(/^\s*export\s+default\s*/)[0].length;
}
if ( this.shouldInclude || this.declaration.activated ) {

8
test/function/export-default-no-space/_config.js

@ -0,0 +1,8 @@
const assert = require( 'assert' );
module.exports = {
description: 'handles default exports with no space before declaration',
exports: exports => {
assert.deepEqual( exports, {} );
}
};

1
test/function/export-default-no-space/main.js

@ -0,0 +1 @@
export default{};
Loading…
Cancel
Save