Skip to content

Compiler is not correctly work with semicolon #2292

Closed
@NikolayMakhonin

Description

@NikolayMakhonin

(version: 3.0.0-beta.20)
This code:

<script>
    let time = new Date()
    let timeZone = 'UTC'
    ;(() => {
        const timer = setInterval(() => { time = new Date() }, 1000)
        return () => clearInterval(timer)
    })()
</script>

compiled to:

let time = new Date()(() => {
    const timer = setInterval(() => { time = new Date(); $$invalidate('time', time); }, 1000)
    return () => clearInterval(timer)
})()

But if I put semicolon after 'UTC', it worked correctly

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