Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport default values for WebIDL unions #21342
Comments
|
This may have been solved by #22084. Should add a test case in TestBinding.webidl to ensure this works correctly. |
|
I checked that #22084 does not solve this issue. I am still getting the |
|
Ah, so the default value for that particular field is dictionary AudioContextOptions {
(AudioContextLatencyCategory or double) latencyHint = "interactive";
float sampleRate;
};
enum AudioContextLatencyCategory {
"balanced",
"interactive",
"playback"
};And the codegen pukes at The complexity in implementing default values in its complete form is that we need to ensure that the default value falls into the set of possible values as described by the field's type during codegen, e.g. in this case, we must ensure that |
Support enum value as a union default value <!-- Please describe your changes on the following line: --> Didn't implement the actual latency thing because the relevant things are already marked as TODO. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #21342 <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Support enum value as a union default value <!-- Please describe your changes on the following line: --> Didn't implement the actual latency thing because the relevant things are already marked as TODO. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #21342 <!-- Either: --> - [x] There are tests for these changes <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
Generating bindings for this dictionary https://webaudio.github.io/web-audio-api/#dictdef-audiocontextoptions breaks with: