-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Fixes #5477 - Forces computed property names within classes to be executed in strict mode #5689
Conversation
|
||
// Strict mode must be enforced on the evaluation of computed property names inside | ||
// classes, thus enable the flag if the computed property name is a class member. | ||
byteCodeGenerator->forceStrictModeForClassComputedPropertyName = isClassMember; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like maybe here we should be setting isClassMember || prevFlag
. Consider the following (which might be a nice test case too): class C { [{[a.b=3]: 4}[3]]() {} }
. Inside the computed method name on the class (strict mode), we have a computed property name for an object literal (which I believe should also be strict mode, because strict mode affects anything lexically inside the expression).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8cf7bd8
to
2e1392b
Compare
125b2ab
to
84292eb
Compare
…s to be executed in strict mode The ECMA spec requires that a class definition is always strict mode code, this includes computed property names within classes. A flag, forceStrictModeForClassComputedPropertyName, is added into ByteCodeGenerator.h. When set, this flag will force bytecode opcodes to be emitted in strict mode when avaliable. This flag is set outside of emit calls under the condition that the bytecode being emitted corresponds to computed property names within classes.
4c099d6
to
4f3f3bf
Compare
…mputed property names within classes to be executed in strict mode Merge pull request chakra-core#5689 from wyrichte:bug_5477_fixed Forces computed property names within classes to be executed in strict mode. The ECMA spec requires that a class definition is always strict mode code, this includes computed property names within classes. A flag, forceStrictModeForClassComputedPropertyName, is added into ByteCodeGenerator.h. When set, this flag will force bytecode opcodes to be emitted in strict mode when avaliable. This flag is set outside of emit calls under the condition that the bytecode being emitted corresponds to computed property names within classes.
Forces computed property names within classes to be executed in strict mode.
The ECMA spec requires that a class definition is always strict mode code, this includes computed property names within classes. A flag, forceStrictModeForClassComputedPropertyName, is added into ByteCodeGenerator.h. When set, this flag will force bytecode opcodes to be emitted in strict mode when avaliable. This flag is set outside of emit calls under the condition that the bytecode being emitted corresponds to computed property names within classes.