Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow getters, setters and deleters to be shadowed in derived class #258

Conversation

UndefinedBehaviour
Copy link
Contributor

@domenic
Copy link
Member

domenic commented Feb 4, 2022

Thanks! Can you add a test by dropping a file or two into https://github.com/jsdom/webidl2js/tree/master/test/cases , which fails before this change but passes after?

@UndefinedBehaviour
Copy link
Contributor Author

There you go!

Comment on lines -216 to -218
if (this.namedGetter) {
throw new Error(`${msg}duplicated named getter`);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could also change the condition to if (this.hasOwnProperty(member)) in order to keep at least a check on duplicated member names, but I noticed this kind of check is not in place for regular attributes either, so i preferred to have the same behaviour for getters and setters as well i.e. if multiple members have the same name, simply use the last defined one and discard all the others.

@domenic domenic merged commit 2c41ed6 into jsdom:master Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants