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 upExtract some of CGClassConstructHook to utils.rs #25432
Conversation
highfive
commented
Jan 5, 2020
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @paulrouget (or someone else) soon. |
highfive
commented
Jan 5, 2020
|
Heads up! This PR modifies the following files:
|
highfive
commented
Jan 5, 2020
|
This is definitely an improvement! |
|
|
515c950
to
68c476a
| } | ||
| // Wrap prototype in this context since it is from the newTarget compartment | ||
| if !JS_WrapObject(*cx, RawMutableHandle::from(prototype.handle_mut())) { | ||
| return Err(Error::Type("false".to_owned())); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| b"prototype\\0".as_ptr() as *const _, | ||
| proto_val.handle_mut(), | ||
| ) { | ||
| return Err(Error::Type("false".to_owned())); |
This comment has been minimized.
This comment has been minimized.
warren-fisher
Jan 14, 2020
Author
Contributor
I am not sure what type of error is appropriate to return here. Previously it was a return false when it was within the monolithic function. For the sake of getting something "working" I made this placeholder error. Perhaps it is not suitable to throw an error here, and in that case I am not sure the best way of handling this.
This comment has been minimized.
This comment has been minimized.
|
Almost there! |
| b"prototype\\0".as_ptr() as *const _, | ||
| proto_val.handle_mut(), | ||
| ) { | ||
| return Err(Error::Type("false".to_owned())); |
This comment has been minimized.
This comment has been minimized.
| } | ||
| // Wrap prototype in this context since it is from the newTarget compartment | ||
| if !JS_WrapObject(*cx, RawMutableHandle::from(prototype.handle_mut())) { | ||
| return Err(Error::Type("false".to_owned())); |
This comment has been minimized.
This comment has been minimized.
It's both compile time and the size of the generated code - monomorphization can easily end up duplicating large blocks of code that do not depend on any generic types, and relying on the compiler to notice this and de-duplicate them doesn't always work. |
|
@bors-servo try=wpt |
Extract some of CGClassConstructHook to utils.rs <!-- Please describe your changes on the following line: --> Moving some of the functionality from the massive tripled quoted string in CGClassConstructHook in `components/script/dom/bindings/codegen/CodegenRust.py` to `components/script/dom/bindings/utils.rs`. Must be made unsafe because of UnwrapObjectDynamic and other functions. Added imports as necessary as well, as well as cleaning up using test-tidy. --- <!-- 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 #25395 (GitHub issue number if applicable) <!-- Either: --> - [ ] There are tests for these changes OR - [x] These changes do not require tests because the issue says so <!-- 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. -->
02dbb50
to
f2f2738
|
I fixed up the commit history a bit. Not sure if that will cause bors-servo to mess up at all. |
|
|
Extract some of CGClassConstructHook to utils.rs <!-- Please describe your changes on the following line: --> Moving some of the functionality from the massive tripled quoted string in CGClassConstructHook in `components/script/dom/bindings/codegen/CodegenRust.py` to `components/script/dom/bindings/utils.rs`. Must be made unsafe because of UnwrapObjectDynamic and other functions. Added imports as necessary as well, as well as cleaning up using test-tidy. --- <!-- 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 #25395 (GitHub issue number if applicable) <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because the issue says so <!-- 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. -->
|
|
…or.rs
|
@bors-servo r+ |
|
|
Extract some of CGClassConstructHook to utils.rs <!-- Please describe your changes on the following line: --> Moving some of the functionality from the massive tripled quoted string in CGClassConstructHook in `components/script/dom/bindings/codegen/CodegenRust.py` to `components/script/dom/bindings/utils.rs`. Must be made unsafe because of UnwrapObjectDynamic and other functions. Added imports as necessary as well, as well as cleaning up using test-tidy. --- <!-- 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 #25395 (GitHub issue number if applicable) <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because the issue says so <!-- 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. -->
|
|
|
@bors-servo retry |
|
|
warren-fisher commentedJan 5, 2020
•
edited by jdm
Moving some of the functionality from the massive tripled quoted string in CGClassConstructHook in
components/script/dom/bindings/codegen/CodegenRust.pytocomponents/script/dom/bindings/utils.rs. Must be made unsafe because of UnwrapObjectDynamic and other functions. Added imports as necessary as well, as well as cleaning up using test-tidy../mach build -ddoes not report any errors./mach test-tidydoes not report any errors