Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

declare doesn't work with await and block scope #95

Open
Soulike opened this issue Oct 5, 2021 · 0 comments
Open

declare doesn't work with await and block scope #95

Soulike opened this issue Oct 5, 2021 · 0 comments

Comments

@Soulike
Copy link

Soulike commented Oct 5, 2021

I want to use declare to get all variable declarations but encounter a problem.

Analysis Code

this.declare = (iid, name) =>
{
    console.log(`declare: ${iid} ${name}`);
}

Analyzed Code

async function test()
{
    {   // some block scope
        let a = await 1;    // or const
    }
}

test();

And the output is like:

declare: 1 exports
declare: 1 require
declare: 1 module
declare: 1 __filename
declare: 1 __dirname
declare: 2 test

declare is never called for a. The combination of let/const and await does not emit declare. If I use var or remove await, declare will be called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant