Skip to content
This repository was archived by the owner on May 19, 2018. It is now read-only.
/ babylon Public archive
This repository was archived by the owner on May 19, 2018. It is now read-only.

export default function has null id, but spec says id must not be null #502

@ghost

Description

Input Code

export default function() {}

Babylon Use

const babylon = require("babylon");
const src = "export default function() {}";
const ast = babylon.parse(src, { sourceType: "module" });
console.log(JSON.stringify(ast.program.body[0], undefined, 2));

Expected Behavior

Either:

  • This should be parsed as a FunctionExpression.
  • FunctionDeclaration may have a null id.

Current Behavior

Spec declares that FunctionDeclaration must not have a null id.

But in the output:

"declaration": {
  "type": "FunctionDeclaration",
  ...
  "id": null,
  ...
}

Your Environment

software version
Babylon 7.0.0-beta.8
node 7.9.0
npm 4.2.0
Operating System Linux Mint 18

Related: #257

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions