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

Distinguish between function expressions and function declarations #489

Open
saelo opened this issue Dec 31, 2024 · 0 comments
Open

Distinguish between function expressions and function declarations #489

saelo opened this issue Dec 31, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@saelo
Copy link
Collaborator

saelo commented Dec 31, 2024

Currently we only support function declarations in FuzzIL, i.e. something like

function foo() {
    ...
}

But not

let foo = function() {
    ...
}

For the most part, it doesn't really matter whether we emit function statements or expressions, but in certain situations the difference is observable, for example here:

let x = function foo(n) {
  if (n == 0) return;
  foo(n-1);
}
x(10);

I'm not sure how best to support this. Probably the easiest way would be to simply add a boolean flag to BeginAnyFunctionDefinition that states whether the function should become an expression or a statement.

@saelo saelo added the enhancement New feature or request label Dec 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant