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

Update bindings generator to support default ByteString values in a dictionary #12737

Closed
malisas opened this issue Aug 4, 2016 · 4 comments
Closed

Comments

@malisas
Copy link
Contributor

@malisas malisas commented Aug 4, 2016

The Web IDL ByteString spec previously said:

There is no way to represent a constant ByteString value in IDL.

But in response to an issue I filed, it has now been changed to say:

There is no way to represent a constant ByteString value in IDL, although ByteString dictionary member and operation optional argument default values can be specified using a string literal.

Conclusion: Servo's bindings generator should be updated to support default ByteString values in a dictionary.

More about string literals: here
This blocks #11896

@Ms2ger
Copy link
Contributor

@Ms2ger Ms2ger commented Aug 5, 2016

@malisas: are you planning to work on this? Feel free to ping me or jdm if you need help.

@malisas
Copy link
Contributor Author

@malisas malisas commented Aug 5, 2016

Sure, I'll give it a shot!

@jdm
Copy link
Member

@jdm jdm commented Aug 5, 2016

There will be two parts to this - allowing default values for ByteStrings in the parser, and generating appropriate Rust code for ByteString values with default values in the code generator. As a good testcase for this work, I suggest adding a ByteString dictionary member with a default value to TestBinding.webidl, as well as a method that accepts an optional ByteString argument with a default value.

Code: components/script/dom/bindings/codegen/parser/WebIDL.py, components/script/dom/bindings/codegen/CodegenRust.py

@jdm
Copy link
Member

@jdm jdm commented Aug 5, 2016

Relevant code in CodegenRust.py is in the isDOMString() and isUSVString() branches of getJSToNativeConversionInfo.

@nox nox added the C-assigned label Aug 9, 2016
bors-servo added a commit that referenced this issue Aug 11, 2016
Update bindings generator to support default ByteString values in a dictionary

<!-- Please describe your changes on the following line: -->
Update bindings generator to support default ByteString values in a dictionary.

---
<!-- 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 #12737 (github issue number if applicable).

<!-- Either: -->
- [X] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12790)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants
You can’t perform that action at this time.