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
Compiler doesn't remove unreachable branches #3128
Comments
I expect we could change collapse properties to handle this fairly easily. I'm a bit suprised it doesn't already. You can however get the results you want by avoiding quoted keys: |
@concavelenz thanks for the response. I preferred bracket notation, especially when these flags come from outside, but I guess this can be rewritten to support dot notation. I'm a bit surprised that having the |
I suspect that As for the quoted keys - I'd be pretty wary of CollapseProperties doing anything with quoted properties. That's normally what you do to have the compiler be completely hands off. |
@ChadKillingsworth as you suggested I tried avoiding all quoted keys.
Command
|
Not sure why the function is causing problems, but you are going to get much better elimination if you aren't depending on CollapseProperties. Variables work much more dependably than object properties for this. |
@ChadKillingsworth this makes sense. I think my example was oversimplified. The structure is going to be very similar, but the function is imported from a module. |
This can be a limitation of the compiler.
Input:
Command:
Output:
I would expect the output to only contain one console.log as other branches are unreachable.
Is this not possible, e.g. is it unable to determine these conditions in compilation time?
The text was updated successfully, but these errors were encountered: