Skip to content

Issue in duplicate key logic in sections 4.5, 4.6, and 4.7 #78

@rbuckton

Description

@rbuckton

In section 4.5 Decorate Class, step 2 we create a keys List and add each key from each element.

In section 4.6 Decorate Element, step 3.g we throw an error if element.[[Key]] is in keys. Also in step 3.k.i.1 we do the same thing for each item of extras.

In section 4.7 Decorate Constructor, step 2.e.ii. we throw an error if there are any duplicate keys in elements.

The issue is that we perform this key validation without regard to placement. It is perfectly legal in JavaScript to have two elements of the same name if one is static and the other is on the prototype. We also might want to consider allowing duplication between "prototype" and "own" placements to allow people to define methods on the prototype that are overwritten with bound "own" members during initialization.

As a result, I would expect that we need to track three sets of keys, one for each placement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions