Skip to content

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 #5696

@wyrichte

Description

@wyrichte

#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 │
└─────────┴─────────────────────────────────────────────────────┘

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions