chakra-core / chakra-core/ChakraCore

Error not thrown when calling eval() on an assignment expression that is not valid in strict mode within a computed property name within a class

Open
#5,696 0 comments 0 reactions 0 assignees View on GitHub
Bug Severity: 3
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

#5477 showed that ChakraCore does not throw an error when an assignment expression that is not allowed in strict mode is used as the computed property name of a member function within a class.

#5689 fixed many cases that arise from the issue stated above.

A case that is not fixed is when the invalid strict mode assignment expression is within a call to eval:

```
class C {
[eval("a = 5")]() { }
}
```

Testing against other engines:
```
eshost -x -t bug.js
┌─────────┬─────────────────────────────────────────────────────┐
│ jsvu-ch │ │
├─────────┼─────────────────────────────────────────────────────┤
│ jsvu-d8 │ │
│ │ ReferenceError: a is not defined │
├─────────┼─────────────────────────────────────────────────────┤
│ jsvu-sm │ │
│ │ ReferenceError: assignment to undeclared variable a │
└─────────┴─────────────────────────────────────────────────────┘

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.