Skip to content

Arguments exotic object tests are missing accessor cases #817

Open
@caiolima

Description

@caiolima

Consider this code:

function fn(a, b) {
  Object.defineProperty(arguments, '0', { get() { return 42 } })
  console.log(a, arguments[0]) // should be 0, 42

  Object.defineProperty(arguments, '0', { value: 74 })
  console.log(a, arguments[0]) // should be 0, 74

  Object.defineProperty(arguments, '1', { value: 1 })
  console.log(b, arguments[1]) // should be 1, 1

  arguments[0] = 'foo';
  console.log(a, arguments[0]) // should be 0, 74 (get is preserved)

  arguments[1] = 'bar';
  console.log(b, arguments[1]) // should be 'bar', 'bar'
}

fn(0, 39)

This piece of code is testing mapping rules when an argument is defined as getter. We should also have related test when a setter is defined.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions