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

export default async function parsed as FunctionExpression #257

@daltones

Description

@daltones

Input Code

export async function foo() {}
export default async function bar() {}

See https://astexplorer.net/#/V8ggvAMIw1

Babylon/Babel Configuration

Experimenting on AST explorer with babylon6-6.13.1 and all default options.

Expected Behavior

The second line should be parsed as an ExportDefaultDeclaration and a FunctionDeclaration.

Current Behavior

The second line is being parsed as an ExportDefaultDeclaration and a FunctionExpression.

A named export with a function declaration leads to FunctionDeclaration whenever it's regular, async or generator function.

But a default export with a function declaration leads to FunctionDeclaration only when it's regular or generator function. Async functions lead to FunctionExpression. I guess that's a bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions