Skip to content

Function expression wrapped in parentheses does not parse #29

Open
@olejorgenb

Description

@olejorgenb

let foo = (function() { return 1; })

(function() { return 1; })()

Cause by Reflect.parse weirdness - the opening parenthesis is not included in the span..:

let code = `(function() { return 1; })`;
let body = Reflect.parse (code, {line: 0})
let lines = code.split('\n')
span(lines, body.body[0].loc)
// "function() { return 1; })"

Not trivial to to work around unfortunately.

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