Skip to content

Regexp/division after ]} not properly disambiguated #22

@nicolo-ribaudo

Description

@nicolo-ribaudo

Consider these two inputs:

void {
    x: []
} / "/ //" /*

/*/

module.exports.foo = 2;

// */
{
    x: []
} / "/ //" /*

/*/

module.exports.foo = 2;

// */

In the first one it's an object divided by the string "/ //", followed by a comment and by the expression module.exports.foo = 2;.

In the second one it's a block containing a labeled statement (x: []), then there is a regular expression (/ "/), and inline comment and a block comment.

However, it returns exports: [ 'foo' ] for both the examples.

(Sorry for those /*//// */ patterns, but I need them to write "dual mode" code to toggle between code and comments 😅)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions