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

Tweak test cases for dictionary defaults #225

Merged
merged 2 commits into from
May 20, 2020
Merged

Conversation

domenic
Copy link
Member

@domenic domenic commented May 18, 2020

In Web IDL these days, optional dictionary arguments must have a trailing "= {}". This adds those to the test .webidl files. Doing so uncovered an issue where DOMRectInit was referenced in the test files, but did not exist, so we add code to throw in this case, and correct the test file.

In Web IDL these days, optional dictionary arguments must have a trailing "= {}". This adds those to the test .webidl files. Doing so uncovered an issue where DOMRectInit was referenced in the test files, but did not exist, so we add code to throw in this case, and correct the test file.
Copy link
Member

@TimothyGu TimothyGu left a comment

Choose a reason for hiding this comment

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

LGTM with 1 comment.

overload.operation.arguments[i].default.type === "dictionary";
if (isDefaultedDictionary && !ctx.dictionaries.has(idlType.idlType)) {
throw new Error(
`The dictionary ${idlType.idlType} was referenced in an argument list, but doesn't exist`);
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't it also be another class of errors: the default value is incorrectly set to be {}?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fair point. So, maybe something like "The argument X was defaulted to {}, but there is no dictionary named Y".

@domenic domenic merged commit 7486702 into master May 20, 2020
@domenic domenic deleted the dictionary-defaults branch May 20, 2020 20:07
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