-
Notifications
You must be signed in to change notification settings - Fork 653
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
A possible bug about calling eval in strict mode #102
Comments
Can I take this? |
@YaoHouyou thank you for catching this! It does indeed look like a bug. BTW, please keep in mind that Hermes does not currently fully support local eval(), so for example it can't access local variables. |
@ykabusalah we are happy to accept community contributions. While conceptually simple, fixing this issue requires changes in several places in the compiler and the interpreter, so it may be challenging if you are not already familiar with the code base. Here is what we need to do: we need to add a new operand "strictMode" to the If you like, feel free to give it a try. |
- Disable Stats Timer (fixes facebook#92) - Include revision as part of product version in addition to suffix (fixes facebook#91) - Include license file in NuGet (fixes facebook#98) - Add Source Link to linker (fixes facebook#102) This is ported from the v0.11 branch. We bump the version up to 0.12 (even though no such version exists in upstream) to signal we're no longer compatible with 0.11 (and RN 0.68).
Propagating function strictness to direct |
Version: 3ed8340
Testcase:
Command:
./build/bin/hermes -w testcase.js
Output:
Expected output:
Throw SyntaxError on Line 3
Description:
According to the ES standard, eval code is strict mode code if the call to eval is contained in strict mode code. In the testcase above, the eval code should be strict mode code, and the reserved word "public" cannot be used as a variable name in strict mode, so a SyntaxError should be thrown on Line 3. However, Hermes did not throw any exceptions when running the above testcase.
The reference of the ES standard is as follows:
http://www.ecma-international.org/ecma-262/6.0/index.html#sec-strict-mode-code
The text was updated successfully, but these errors were encountered: