Skip to content

Labelled function declarations should be a parse error #3516

Description

@mroch

http://www.ecma-international.org/ecma-262/6.0/#sec-labelled-statements-static-semantics-early-errors

In strict mode, something like x: function y() {} should be a syntax error. In non-strict mode, it can (per B.3.2) be a LabeledStatement containing a FunctionDeclaration.

As of Flow 0.41, we parse it as a LabeledStatement containing an ExpressionStatement containing a FunctionExpression in strict and non-strict mode.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions