estools / esvalid

confirm that a SpiderMonkey format AST represents an ECMAScript program
26 stars 7 forks source link

In strict mode, duplicate object property key on a pair of setter and getters is permitted. #40

Closed ikarienator closed 10 years ago

michaelficarra commented 10 years ago

Confirmed. From the spec:

  • Let previous be the result of calling the [[GetOwnProperty]] internal method of obj with argument propId.name.
  • If previous is not undefined then throw a SyntaxError exception if any of the following conditions are true
    • This production is contained in strict code and IsDataDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
    • IsDataDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true.
    • IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
    • IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true and either both previous and propId.descriptor have [[Get]] fields or both previous and propId.descriptor have [[Set]] fields