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

context masks turns into negative value #193

Open
KFlash opened this issue May 26, 2021 · 5 comments
Open

context masks turns into negative value #193

KFlash opened this issue May 26, 2021 · 5 comments

Comments

@KFlash
Copy link
Contributor

KFlash commented May 26, 2021

OptionsUniqueKeyInPattern = 1 << 31, is a negative value and can cause conflicts and unexpected things can happen :)

@3cp
Copy link
Member

3cp commented May 26, 2021

As long as we only do bitwise operations around those options, it could be fine?

@3cp
Copy link
Member

3cp commented May 26, 2021

@KFlash
Copy link
Contributor Author

KFlash commented May 26, 2021

It looks okay, but I guess it's value is something like '-242585759" ? I didn't check it, but in some cases NodeJS / browser can end up mixing together multiple context masks when this is the only one you want to use. So suddenly you are in strict mode and disallow in context while parsing in module goal etc.

@prantlf
Copy link
Contributor

prantlf commented May 7, 2022

I hope that you're right that the current code is fine. Shouldn't the following check use === 0, so that we can sleep well? I suspect that as soon as somebody sets options.uniqueKeyInPattern the condition will accidentally return true...

if ((context & Context.SuperCall) < 1) report(parser, Errors.SuperNoConstructor);

3cp added a commit that referenced this issue Jun 1, 2022
@3cp
Copy link
Member

3cp commented Jun 1, 2022

It's possible to use bigint to store the option bits, it supports all bitwise operations.
The question is whether we want to take the performance hit (but I have not found any existing benchmark for bigint bitwise operations).

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

3 participants